Esempio n. 1
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
Esempio n. 2
0
def calcElevContrForce(inputFile):
    '''
    DESCRIPTION:    This function calculates the reduced elevator control force for each meassurement taken during the second stationary measurement series.
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n
    ... SI [Condition]:                 By default set to SI=True\n

    OUTPUT:\n
    ... FeRed [Arary]:                  Numpy array containing the reduced elevator control force
    '''

    # Import data
    param          = imPar.parametersStatic()
    static2a       = imStat.staticMeas(inputFile, 'static2a', SI=True)
    static2aWeight = imWeight.calcWeightCG(inputFile, 'static2a')

    # Obtain values from data
    Ws = param.Ws
    Fe = static2a['Fe'].to_numpy()
    W  = static2aWeight['Weight'].to_numpy()

    # Calculation
    FeRed = Fe * Ws / W
    return FeRed
Esempio n. 3
0
def calcElevDeflection(inputFile):
    '''
    DESCRIPTION:    This function calculates the reduced elevator deflection for each meassurement taken during the second stationary meassurement series.
    ========
    INPUT:\n
    ... inputFile [String]:             Name of excel file; choose between 'reference' or 'actual'\n
    ... SI [Condition]:                 By default set to SI=True\n

    OUTPUT:\n
    ... deltaRed [Array]:               Numpy array containing the reduced elevator deflections
    ... Cma [float]:                    Longitudinal stability parameter
    '''

    # Import data
    param             = imPar.parametersStatic()
    static2a          = imStat.staticMeas(inputFile, 'static2a', SI=True)
    staticThrust2aRed = imStat.staticThrust(inputFile, 'static2a', standard=True)
    staticThrust2a    = imStat.staticThrust(inputFile, 'static2a', standard=False)

    # Obtain values from data
    CmTc  = param.CmTc
    delta = static2a['delta'].to_numpy()
    aoa   = static2a['aoa'].to_numpy()
    Tcs   = staticThrust2aRed['Tcs'].to_numpy()
    Tc    = staticThrust2a['Tc'].to_numpy()
    Cmdelta = calcElevEffectiveness(inputFile)

    # Calculations
    deltaRed = delta - CmTc * (Tcs - Tc) / Cmdelta
    linregress = stats.linregress(aoa, delta)
    Cma = -1* linregress.slope * Cmdelta

    return deltaRed, Cma
Esempio n. 4
0
def plotElevTrimCurve(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_nonSI = imStat.staticMeas(inputFile,'static2a',SI=False)
    Weight2a     = imWeight.calcWeightCG(inputFile, 'static2a')
    
    # Obtain values from data
    aoa_deg   = static2a_nonSI['aoa'].to_numpy()
    delta_deg = static2a_nonSI['delta'].to_numpy()
    Xcg      = np.average(Weight2a['Xcg'].to_numpy())
    Weight   = np.average(Weight2a['Weight'].to_numpy())

    # Calculations
    linregress = stats.linregress(aoa_deg, delta_deg)

    # Start plotting
    plt.figure('Elevator trim curve',[10,7])
    plt.title("Elevator Trim Curve",fontsize=22)
    plt.scatter(aoa_deg,delta_deg)
    plt.plot(np.sort(aoa_deg),np.sort(aoa_deg)*linregress.slope + linregress.intercept, 'k--')
    plt.ylim(1.2*max(delta_deg),1.2*min(delta_deg))
    plt.grid()

    plt.xlim(0.9*np.sort(aoa_deg)[0],1.1*np.sort(aoa_deg)[-1])
    plt.xlabel(r'$\alpha$   [$\degree$]',fontsize=16)
    plt.ylabel(r'$\delta_{e}$   [$\degree$]',fontsize=16)
    plt.axhline(0,color='k')

    props = dict(boxstyle='round', facecolor='white', alpha=0.5)
    # plt.text(1.03*np.sort(aoa_deg)[1],1.05*delta_deg[1],'$x_{cg}$ = 7.15 m\nW = 59875 kg',bbox=props,fontsize=16)
    plt.text(1.03*np.sort(aoa_deg)[1],1.05*delta_deg[1],'$x_{cg}$ = '+str(round(Xcg,2))+' m\nW = '+str(int(round(Weight,0)))+' kg',bbox=props,fontsize=16)

    props = dict(boxstyle='round', facecolor='white', alpha=0.5)
    plt.show()
    return