Ejemplo n.º 1
0
def plotLift(inputFile):
    '''
    DESCRIPTION:    This function plots the CL-alpha curve
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n


    OUTPUT:\n
    '''

    # Import the data
    param = imPar.parametersStatic()
    static1NotSI = imStat.staticMeas(inputFile, 'static1', SI=False)
    aeroCoeff = calcAeroCoeff(inputFile)[-1]
    static1FlightCond = imStat.staticFlightCondition(inputFile, 'static1')

    # Get the required parameters
    aoa_deg = static1NotSI['aoa'].to_numpy()
    CL = aeroCoeff['CL'].to_numpy()

    # Mach range
    M = static1FlightCond['Mach'].to_numpy()
    Mmax = np.max(M)
    Mmin = np.min(M)

    # Reynolds number range
    rho = static1FlightCond['rho'].to_numpy()
    Vt = static1FlightCond['Vt'].to_numpy()
    mac = param.c
    T = static1FlightCond['Temp'].to_numpy() * (9 / 5)  # [Rankine]
    T0 = 518.7  # [Rankine]
    mu0 = 3.62E-7  # [lb s/ft2]

    mu = mu0 * (T / T0)**1.5 * ((T0 + 198.72) / (T + 198.72))
    mu = mu * (0.45359237 / (0.3048**2))

    Re = rho * Vt * mac / mu
    Remax = np.max(Re)
    Remin = np.min(Re)

    # Plot lift curve
    plt.figure('Lift curve', [10, 7])
    plt.title('Lift Curve', fontsize=22)
    plt.plot(aoa_deg, CL, marker='o')
    plt.xlabel(r'$\alpha$ [$\degree$]', fontsize=16)
    plt.ylabel(r'$C_L$ [$-$]', fontsize=16)

    props = dict(boxstyle='round', facecolor='white', alpha=0.5)
    plt.text(1.03 * aoa_deg[1],
             1.05 * CL[-2],
             'Aircraft configuration: Clean' + '\nMach number range: ' +
             str(round(Mmin, 2)) + ' - ' + str(round(Mmax, 2)) +
             '\nReynolds number range: ' + '{:.2e}'.format(Remin) + ' - ' +
             '{:.2e}'.format(Remax),
             bbox=props,
             fontsize=16)
    plt.grid()

    return
Ejemplo n.º 2
0
def calcAeroCoeff(inputFile, dataSet):
    '''
    DESCRIPTION:    This function calculates the lift coefficient for the static measurements. (CL \approx CN)
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n
    ... dataSet [String]:               Name of data set; choose between 'static1', 'static2a' or 'static2b'\n
    ... SI [Condition]:                 By default set to SI=True\n

    OUTPUT:\n
    ... aeroCoeff [Dataframe]:          Pandas dataframe containing Cl, Cd, e, Cla, Cd0, aoa0   
    '''

    # Import data
    param            = imPar.parametersStatic()
    static           = imStat.staticMeas(inputFile, dataSet)
    staticNotSI      = imStat.staticMeas(inputFile, dataSet, SI=False)
    staticFlightCond = imStat.staticFlightCondition(inputFile, dataSet)
    staticTp         = imStat.staticThrust(inputFile, dataSet)
    staticWeight     = imWeight.calcWeightCG(inputFile, dataSet)

    # Obtain vales from data
    S   = param.S
    A   = param.A
    aoa_rad = static['aoa'].to_numpy()
    aoa_deg = staticNotSI['aoa'].to_numpy()
    rho = staticFlightCond['rho'].to_numpy()
    Vt  = staticFlightCond['Vt'].to_numpy()
    W   = staticWeight['Weight'].to_numpy()
    Tp  = staticTp['Tp'].to_numpy()

    # Calculations
    Cl = W / (0.5 * rho * Vt**2 * S)
    Cd = Tp / (0.5 * rho * Vt**2 * S)
    
    aeroCoeff = {}

    if dataSet == 'static1':
        Cl_aoa = stats.linregress(aoa_deg,Cl)
        Cd_Cl2 = stats.linregress(Cl**2,Cd)

        Cla = Cl_aoa.slope
        aoa0 = -Cl_aoa.intercept / Cla
        e = 1/(np.pi*A*Cd_Cl2.slope)
        Cd0 = Cd_Cl2.intercept

        dataNames = ['Cl','Cd','e','Cla','Cd0','aoa0']
        for name in dataNames:
            aeroCoeff[name] = locals()[name]
    else:
        dataNames = ['Cl','Cd']
        for name in dataNames:
            aeroCoeff[name] = locals()[name]
    aeroCoeff = pd.DataFrame(data=aeroCoeff)

    return aeroCoeff
Ejemplo n.º 3
0
def calcAeroCoeff(inputFile):
    '''
    DESCRIPTION:    This function calculates the aerodynamic coefficient for the first static measurement. (CL \approx CN)
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n

    OUTPUT:\n
    ... CLa [float]:                    Lift curve slope
    ... aoa0 [float]:                   Zero lift angle of attack
    ... e [float]:                      Oswald efficiency factor
    ... CD0 [float]:                    Zero lift drag
    ... aeroCoeff [Dataframe]:          Pandas dataframe containing CL, CD  
    '''

    # Import data

    param = imPar.parametersStatic()
    static = imStat.staticMeas(inputFile, 'static1')
    staticNotSI = imStat.staticMeas(inputFile, 'static1', SI=False)
    staticFlightCond = imStat.staticFlightCondition(inputFile, 'static1')
    staticTp = imStat.staticThrust(inputFile, 'static1')
    staticWeight = imWeight.calcWeightCG(inputFile, 'static1')

    # Obtain vales from data
    S = param.S
    A = param.A
    aoa_rad = static['aoa'].to_numpy()
    aoa_deg = staticNotSI['aoa'].to_numpy()
    rho = staticFlightCond['rho'].to_numpy()
    Vt = staticFlightCond['Vt'].to_numpy()
    W = staticWeight['Weight'].to_numpy()
    Tp = staticTp['Tp'].to_numpy()

    # Calculations
    CL = W / (0.5 * rho * Vt**2 * S)
    CD = Tp / (0.5 * rho * Vt**2 * S)
    CL_aoa = stat.linregress(aoa_rad, CL)
    CD_CL2 = stat.linregress(CL**2, CD)

    CLa = CL_aoa.slope
    aoa0 = -CL_aoa.intercept / CLa
    e = 1 / (np.pi * A * CD_CL2.slope)
    CD0 = CD_CL2.intercept

    aeroCoeff = {}
    dataNames = ['CL', 'CD']
    for name in dataNames:
        aeroCoeff[name] = locals()[name]
    aeroCoeff = pd.DataFrame(data=aeroCoeff)

    return CLa, aoa0, e, CD0, aeroCoeff
Ejemplo n.º 4
0
def plotRedElevContrForceCurve(inputFile):
    '''
    DESCRIPTION:    Function description
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n

    OUTPUT:\n
    ... None, but running this function creates a figure which can be displayed by calling plt.plot()
    '''


    # Import data
    static2a     = imStat.staticMeas(inputFile,'static2a')
    flightCond2a = imStat.staticFlightCondition(inputFile,'static2a')
    Weight2a     = imWeight.calcWeightCG(inputFile, 'static2a')
    
    # Obtain values from data
    VeRed = np.sort( flightCond2a['VeRed'].to_numpy() )
    Xcg   = np.average(Weight2a['Xcg'].to_numpy())
    deltaTr = np.rad2deg(np.average(static2a['deltaTr']))

    # Calculation
    FeRed = np.sort(calcElevContrForce(inputFile))

    # Start plotting
    plt.figure('Elevator Force Control Curve',[10,7])
    plt.title("Reduced Elevator Control Force Curve",fontsize=22)
    plt.plot(VeRed,FeRed,marker='o')

    plt.xlim(0.9*VeRed[0],1.1*VeRed[-1])
    plt.xlabel(r'$V_{e}^{*}$   [$\dfrac{m}{s}$]',fontsize=16)
    plt.ylim(1.2*FeRed[-1],1.2*FeRed[0])
    plt.ylabel(r'$F_{e}^{*}$   [N]',fontsize=16)
    plt.axhline(0,color='k')

    props = dict(boxstyle='round', facecolor='white', alpha=0.5)
    plt.text(1.03*VeRed[2],1.05*FeRed[2],'$x_{cg}$ = '+str(round(Xcg,2))+' m\n$\delta_{t_{e}}$ = '+str(round(deltaTr,3))+'$\degree$',bbox=props,fontsize=16)
    plt.grid()
    return