def cruise_range_new(cond, W, c, zeta):
    drag_cru = DragPolar()
    x_list = []

    for V1 in np.linspace(100, 250, 150, endpoint=True):
        for h in np.linspace(10000, 15000, 20, endpoint=True):
            rho = Atmosphere(h).density[0]

            CL_cru = (2 * W) / (rho * V1**2 * jet.S)
            drag_cru.CLp = CL_cru
            drag_cru.Mp = V1 / Atmosphere(h).speed_of_sound[0]
            CD1 = drag_cru.polar()

            E1 = CL_cru / CD1
            Em = 4 * drag_cru.K / drag_cru.CD0

            if (cond == 'h_CL'):

                x = (2 * V1 * E1) / c * (1 - np.sqrt(1 - zeta))
                x_list.append(x)

            elif (cond == 'V_CL'):

                x = E1 * V1 / c * np.log(1 / (1 - zeta))
                x_list.append(x)

            elif (cond == 'V_h'):
                x = (2 * V1 * Em) / c * np.arctan(
                    E1 * zeta / (2 * Em *
                                 (1 - drag_cru.K * E1 * CL_cru * zeta)))
                x_list.append(x)

    return max(x_list)
def cruise_range(cond,W,c,zeta, V1, h1):
    ''' 
    Fornecidos os valores necessários, calcula-se o
    alcance para diferentes configurações:
    V1: Velocidade inicial de cruzeiro;
    h1: Altitude inicial de cruzeiro.    '''

    drag_cru = DragPolar()
    
    rho = Atmosphere(h1).density[0]
    
    CL1_cru = (2*W)/(rho*V1**2*jet.S)
    drag_cru.CLp = CL1_cru
    drag_cru.Mp = V1/Atmosphere(h1).speed_of_sound[0]
    CD1 = drag_cru.polar()
    
    E1 = CL1_cru/CD1
    Em = np.sqrt(drag_cru.CD0/drag_cru.K)/(2*drag_cru.CD0)
    
    if(cond == 'h_CL'):

        x = (2*V1*E1)/c*(1-np.sqrt(1 - zeta))
        
    elif(cond == 'V_CL'):

        x = E1*V1/c*np.log(1/(1 - zeta))
        
    elif(cond == 'V_h'):
        x = (2*V1*Em)/c*np.arctan(E1*zeta/(2*Em*(1 - drag_cru.K*E1*CL1_cru*zeta)))
    
    return x
def cruise_range(cond, V1, h, c, zeta, W):
    '''
    OBS: Inutilizado! (remover antes de entregar)
    Parâmetros
    ----------
    cond : Tipo de voo de cruzeiro, especificando qual variável
    se manterá constante: Velocidade (V), h (altitude) ou CL;
    
    V1 : Velocidade de início; 
    
    h : Altitude de cruzeiro;
    
    c : Coeficiente de consumo;
    
    zeta : Razão W1/W2 dos pesos inicial e final. 

    Returns
    -------
    x : Alcance, em metros.

    '''
    drag_cru = DragPolar()
    rho = Atmosphere(h).density[0]

    CL_cru = (2 * W) / (rho * V1**2 * jet.S)
    drag_cru.CLp = CL_cru
    drag_cru.Mp = V1 / Atmosphere(h).speed_of_sound[0]
    CD1 = drag_cru.polar()

    E1 = CL_cru / CD1
    Em = 4 * drag_cru.K / drag_cru.CD0

    if (cond == 'h_CL'):

        x = (2 * V1 * E1) / c * (1 - np.sqrt(1 - zeta))

    elif (cond == 'V_CL'):

        x = E1 * V1 / c * np.log(1 / (1 - zeta))

    elif (cond == 'V_h'):

        x = (2 * V1 * Em) / c * np.arctan(
            E1 * zeta / (2 * Em * (1 - drag_cru.K * E1 * CL_cru * zeta)))

    return x
Exemple #4
0
def alcance_autonomia_CL(V, graph_E_V=False, save_graph_E_V=False, *altitudes):

    print("----- Alcance e Autonomia [Caso CL constante] -----")

    if graph_E_V == True:

        fig_E, ax_E = plt.subplots(figsize=(6, 4))
        ax_E.set_xlabel("Altitude [m]", fontsize=12)
        ax_E.set_ylabel("Eficiência ", fontsize=12)
        ax_E.grid()
        ax = plt.gca()
        ax.invert_xaxis()

        fig_V, ax_V = plt.subplots(figsize=(6, 4))
        ax_V.grid()
        ax_V.set_xlabel("Altitude [m]", fontsize=12)
        ax_V.set_ylabel("Velocidade [m/s] ", fontsize=12)
        ax = plt.gca()
        ax.invert_xaxis()

    for altitude in altitudes:

        h1 = 0  # [m]
        h2 = altitude  # [m]

        rho = Atmosphere(h2).density[0]

        CL = jet.W / (0.5 * jet.S * (V**2) * rho)  #esse cl é mantido constante

        h_linspace = np.linspace(h2, h1, 800, retstep=True)
        range_h = h_linspace[0]
        range_dh = abs(h_linspace[1])

        deltaX_CL = 0
        t_CL = 0
        E_list = []
        V_list = []

        drag = DragPolar()

        for h in range_h:

            rho_i = (Atmosphere(h).density[0] +
                     Atmosphere(h - range_dh).density[0]) / 2
            velo_som_i = (Atmosphere(h).speed_of_sound[0] +
                          Atmosphere(h - range_dh).speed_of_sound[0]) / 2

            V_i = (jet.W / (0.5 * CL * rho_i * jet.S))**.5

            mach_i = V_i / velo_som_i
            drag.Mp = mach_i

            CL_i = CL  #mantendo o CL igual o CL inicial
            drag.CLp = CL_i
            CD_i = drag.polar()
            E_i = CL_i / CD_i

            #Alcance
            deltaX_CL_i = E_i * range_dh  # E * [h(i+1) - h(i)]
            deltaX_CL += deltaX_CL_i

            E_list.append(E_i)
            V_list.append(V_i)

            #Autonomia
            exp_t = np.e**(-(h - range_dh) / (2 * beta)) - np.e**(-h /
                                                                  (2 * beta))
            t_CL_i = 2 * beta * E_i * (((rho0 * CL_i) /
                                        (2 * jet.WL))**.5) * exp_t
            t_CL += t_CL_i

        print("Altitude : {} m".format(altitude))
        print("Velocidade inicial {} m/s".format(round(V, 2)))
        print("CL : {} ".format(round(CL, 2)))
        print("Alcance: {} m ".format(round(deltaX_CL, 2)))
        print("Autonomia: {} s".format(round(t_CL, 2)))
        print("---------------------------------------------------")

        try:
            ax_E.plot(range_h, E_list, label="Altitude :{} m".format(altitude))
            ax_V.plot(range_h, V_list, label="Altitude :{} m".format(altitude))
        except:
            None

    try:
        ax_E.legend()
        ax_V.legend()
        plt.tight_layout()

        if save_graph_E_V == True:
            fig_E.savefig("eficiencia_cl_constante.pdf")
            fig_V.savefig("velocidade_cl_constante.pdf")
    except:
        None
Exemple #5
0
def hdot_V(velocidade, save_graph=False, *altitudes):

    CL_max = 1

    V_stall = np.sqrt(jet.W /
                      (CL_max * 0.5 * jet.S * Atmosphere(13105).density[0]))

    fig_hdotV = plt.figure()

    V_list = np.linspace(0.4 * V_stall, 1.5 * V_stall, 100)

    for altitude in altitudes:

        hdot_list = []

        rho = Atmosphere(altitude).density[0]
        velo_som = Atmosphere(altitude).speed_of_sound[0]

        drag = DragPolar()

        for Vi in V_list:

            mach = Vi / velo_som

            CL = jet.W / (0.5 * rho * (Vi**2) * jet.S)

            drag.CLp = CL
            drag.Mp = mach
            drag.polar(False)

            CD0 = drag.CD0
            K = drag.K

            CD = CD0 + K * (CL**2)

            E = CL / CD
            gamma = -1 / E
            hdot = Vi * gamma

            hdot_list.append(hdot)

        plt.plot(V_list, hdot_list, label="Altitude: {} m".format(altitude))

    plt.axvline(V_stall,
                ymin=-60,
                ymax=1,
                ls='--',
                color='k',
                label="Velocidade de Stall")
    plt.grid()
    plt.ylim([-30, 1])
    plt.xlim([100, 250])
    plt.xlabel("Velocidade [m/s]", fontsize=12)
    plt.ylabel("Razão de descida $\dot{h}$", fontsize=12)
    plt.legend()
    plt.tight_layout()

    if save_graph == True:
        plt.savefig("hdot_V.pdf")

    plt.show()
Exemple #6
0
def alcance_autonomia_V(V, graph=False, save_graph=False, *altitudes):

    print("----- Alcance e Autonomia [Caso V constante] -----")

    if graph == True:

        fig_E, ax_E = plt.subplots(figsize=(6, 4))
        ax_E.set_xlabel("Altitude [m]", fontsize=12)
        ax_E.set_ylabel("Eficiência ", fontsize=12)
        ax_E.grid()
        ax = plt.gca()
        ax.invert_xaxis()

        fig_CL, ax_CL = plt.subplots(figsize=(6, 4))
        ax_CL.grid()
        ax_CL.set_xlabel("Altitude [m]", fontsize=12)
        ax_CL.set_ylabel("$C_L$", fontsize=12)
        ax = plt.gca()
        ax.invert_xaxis()

    for altitude in altitudes:

        ## Considerando velocidade e altitude de cruzeiro
        h1 = 0  # [m]
        h2 = altitude  # [m]

        h_linspace = np.linspace(h2, h1, 800, retstep=True)
        range_h = h_linspace[0]
        range_dh = abs(h_linspace[1])

        deltaX_V = 0
        t_V = 0
        E_list = []
        CL_list = []

        drag = DragPolar()

        for h in range_h:

            rho_i = (Atmosphere(h).density[0] +
                     Atmosphere(h - range_dh).density[0]) / 2
            velo_som_i = (Atmosphere(h).speed_of_sound[0] +
                          Atmosphere(h - range_dh).speed_of_sound[0]) / 2

            mach_i = V / velo_som_i
            drag.Mp = mach_i

            CL_i = (2 * jet.WL) / (rho_i * V**2)
            drag.CLp = CL_i
            CD_i = drag.polar()
            E_i = CL_i / CD_i

            A_i = (rho0 * drag.CD0 * V**2) / (2 * jet.WL)
            B_i = (2 * drag.K * jet.WL) / (rho0 * V**2)

            tan1_i = np.arctan((A_i / B_i) * np.e**(-(h - range_dh) / beta))
            tan2_i = np.arctan((A_i / B_i) * np.e**(-h / beta))

            #Alcance
            deltaX_V_i = (beta / B_i) * (tan1_i - tan2_i)
            deltaX_V += deltaX_V_i

            #Autonomia
            t_V_i = beta / (B_i * V) * (tan1_i - tan2_i)
            t_V += t_V_i

            E_list.append(E_i)
            CL_list.append(CL_i)

        print("Altitude : {} m".format(altitude))
        print("Velocidade {} m/s".format(round(V, 2)))
        print("Alcance: {} m".format(round(deltaX_V, 2)))
        print("Autonomia: {} s".format(round(t_V, 2)))
        print("---------------------------------------------------")

        try:
            ax_E.plot(range_h, E_list, label="Altitude :{} m".format(altitude))
            ax_CL.plot(range_h,
                       CL_list,
                       label="Altitude :{} m".format(altitude))
        except:
            None

    try:
        ax_E.legend()
        ax_CL.legend()
        plt.tight_layout()

        if save_graph == True:
            fig_E.savefig("eficiencia_v_constante.pdf")
            fig_CL.savefig("cl_v_constante.pdf")
    except:
        None
Exemple #7
0
    plt.ylim([-30, 1])
    plt.xlim([100, 250])
    plt.xlabel("Velocidade [m/s]", fontsize=12)
    plt.ylabel("Razão de descida $\dot{h}$", fontsize=12)
    plt.legend()
    plt.tight_layout()

    if save_graph == True:
        plt.savefig("hdot_V.pdf")

    plt.show()


#%% Parâmetros ótimos para CL constante

drag_CL = DragPolar()
drag_CL.CLp = 0


def max_CL_cte(x, h1, h2, cond):

    rho = (Atmosphere(h1).density[0] + Atmosphere(h2).density[0]) / 2
    velo_som = (Atmosphere(h1).speed_of_sound[0] +
                Atmosphere(h2).speed_of_sound[0]) / 2

    # Variáveis desconhecidas:
    CD0 = x[0]
    k = x[1]
    V = x[2]

    drag_CL.Mp = V / velo_som
from aircraft import JetStar
from scipy.optimize import fsolve

plt.close('all')

#%% Dados Gerais
jet = JetStar(1)

sealevel = Atmosphere(0)
beta = 9296
rho0 = sealevel.density[0]

#%% Funções para Voo em Cruzeiro

# Polar de arrasto
drag_object = DragPolar()
drag_object.CLp = 0


def total_drag(V, h):
    '''
    
    Parâmetros
    ----------
    V : Lista de velocidades definida em "MAIN".
    h : Lista de altitudes definida em "MAIN".

    Returns
    -------
    D_resp : Arrasto total em cruzeiro (lista)
    Dmin_resp : Arrasto mínimo em cruzeiro (lista)
        label='MMQ')
ax.scatter(CL_data['Alpha (deg)'],
           CL_data['CL'],
           color='r',
           label='Experimental')
ax.set_xlabel('$AoA_{trim}$ [deg]')
ax.set_ylabel('CL')
ax.legend()

# CL x alpha x Mach e CD x alpha x Mach
from Interpolacao import DragPolar
alpha_Lzero = -CL_zero / CL_alpha
fig, ax = plt.subplots(1, 2, figsize=(12, 4))
ax[0].grid()
ax[1].grid()
drag = DragPolar()

for i in range(len(machs)):
    cl_alphai = np.interp(machs[i], aircraft.CL_alpha_mach['mach'],
                          aircraft.CL_alpha_mach['CL_alpha'])
    cl_i = cl_alphai * np.deg2rad(alphas - alpha_Lzero)
    drag.CLp = cl_i
    drag.Mp = machs[i]
    cd_i = drag.polar()
    ax[0].plot(alphas, cl_i, color=cores[i], label=f'Mach = {machs[i]}')
    ax[1].plot(alphas, cd_i, color=cores[i], label=f'Mach = {machs[i]}')
ax[0].set_xlabel('AoA [deg]')
ax[1].set_xlabel('AoA [deg]')
ax[0].set_ylabel('CL')
ax[1].set_ylabel('CD')
ax[0].legend()
Exemple #10
0
from aircraft import JetStar
import numpy as np
import matplotlib.pyplot as plt
from ambiance import Atmosphere
from Interpolacao import DragPolar
from scipy.optimize import fsolve
import Cruzeiro as cr

# =============================================
jet = JetStar(1)

sealevel = Atmosphere(0)
beta = 9296
rho0 = sealevel.density[0]

drag_asc = DragPolar()
drag_asc.CLp = 0

# =============================================

def gamma(h,T0,n,W,V):
    
    T = cr.jet_buoyancy(h, T0, n)[0]
    D = cr.total_drag(V, h)[0][0]
    return (T - D)/W

def h_dot(h,T0,n,W,V):
    
    T = cr.jet_buoyancy(h, T0, n)[0]
    D = cr.total_drag(V, h)[0][0]
    h_dot = (T*V - D*V)/W
Exemple #11
0
jet = JetStar(None)
h_cruz = 42500 * 0.3048  # ft
M = 20000  # kg
M_pouso = 13000  # kg
rho_SL = Atmo(0).density[0]
g = 9.81
h_cgh = 802  # m
h_bsb = 1066  # m
Mach_cruz = 0.85
V_cruz = Atmo(h_cruz).speed_of_sound[0] * Mach_cruz
dist_voo = 1000  # km
# potencia
n = 0.85
T0 = 64000
# arrasto
drag = DragPolar()
# CL
CL_max = 1.34


#%% razao de subida
def P_req(h, V):
    rho = Atmo(h).density[0]
    cl = 2 * M * g / (jet.S * rho * V**2)
    drag.CLp = cl
    drag.Mp = V / Atmo(h).speed_of_sound[0]
    cd = drag.polar()
    return (0.5 * rho * pow(V, 2) * cd * jet.S) * V


def P_disp(h, V):
Exemple #12
0
from scipy.optimize import fsolve

from aircraft import JetStar
from ambiance import Atmosphere
from Interpolacao import DragPolar
from Cruzeiro import jet_buoyancy

# =============================================
jet = JetStar(1)
sealevel = Atmosphere(0)
rho0 = sealevel.density[0]
g = 9.81
# =============================================

# Polar de arrasto
drag_manobra = DragPolar()


def CL(fc, V, h):
    '''
    Coeficiente de sustentação em curva coordenada.

    Entradas:

    h: Altitude (inteiro)
    V: Velocidade (lista)
    
    '''
    rho = Atmosphere(h).density[0]
    CL = 2 * fc * jet.W / (rho * (V**2) * jet.S)
    return CL