コード例 #1
0
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../..'))

import numpy as np
from gpkit import ureg
from matplotlib import pyplot as plt
from noise_models import noise_weighting

#Computations
f_peak_array = np.logspace(np.log10(100), np.log10(40000),
                           100) * ureg.turn / ureg.s
A_weighting_response_function = np.zeros(np.size(f_peak_array))
vortex_dBA_offset = np.zeros(np.size(f_peak_array))

A_weighting_response_function = noise_weighting(f_peak_array,
                                                A_weighting_response_function,
                                                type="A")

for i, f_peak in enumerate(f_peak_array):

    spectrum = {}
    spectrum["f"] = f_peak * [0.5, 1, 2, 4, 8, 16]
    spectrum["SPL"] = -np.array([7.92, 4.17, 8.33, 8.75, 12.92, 13.33])

    spectrum["SPL"] = noise_weighting(spectrum["f"], spectrum["SPL"], type="A")

    fr = (spectrum["f"] / f_peak).to(
        ureg.dimensionless)  #frequency ratio array

    weighted_p_ratio_squared = 0
コード例 #2
0
plt.rc('axes', axisbelow=True)
plt.show()

#Find value of y closest to that desired
y_desired = 1000 * ureg.feet
idx = (np.abs(y_array - y_desired)).argmin()
y_selected = y_array[idx]

for i, config in enumerate(configs):

    c = configs[config]

    #Rotational noise (1st harmonic only)
    rotational_f = c["y"]["rotational"]["spectrum"][idx]["f"][0]
    rotational_SPL = c["y"]["rotational"]["spectrum"][idx]["SPL"][0]
    rotational_SPL_A = noise_weighting(rotational_f, rotational_SPL)

    #Vortex noise
    vortex_f_spectrum = c["y"]["vortex"]["spectrum"][idx]["f"]
    vortex_SPL_spectrum = c["y"]["vortex"]["spectrum"][idx]["SPL"]
    vortex_SPL_A_spectrum = noise_weighting(vortex_f_spectrum,
                                            vortex_SPL_spectrum)

    #A-weighting spectrum
    f_min_rev_per_s = rotational_f.to(ureg.turn / ureg.s).magnitude
    f_max_rev_per_s = np.max(
        vortex_f_spectrum.to(ureg.turn / ureg.s).magnitude)
    f_dBA_offset = np.linspace(f_min_rev_per_s, f_max_rev_per_s,
                               100) * ureg.turn / ureg.s
    dBA_offset = noise_weighting(f_dBA_offset,
                                 np.zeros(np.shape(f_dBA_offset)))
コード例 #3
0
ファイル: dBA_offsets.py プロジェクト: batinbugday/eVTOL
import os
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/../../models'))

import numpy as np
from gpkit import ureg
from matplotlib import pyplot as plt
from noise_models import noise_weighting

#Computations
f_peak_array = np.logspace(np.log10(100), np.log10(40000),
                           100) * ureg.turn / ureg.s
A_weighting_response_function = np.zeros(np.size(f_peak_array))
vortex_dBA_offset = np.zeros(np.size(f_peak_array))

A_weighting_response_function = noise_weighting(
    f=f_peak_array, SPL=A_weighting_response_function, weighting="A")

for i, f_peak in enumerate(f_peak_array):

    spectrum = {}
    spectrum["f"] = f_peak * [0.5, 1, 2, 4, 8, 16]
    spectrum["SPL"] = -np.array([7.92, 4.17, 8.33, 8.75, 12.92, 13.33])
    spectrum["SPL"] = noise_weighting(f=spectrum["f"],
                                      SPL=spectrum["SPL"],
                                      weighting="A")

    fr = (spectrum["f"] / f_peak).to(
        ureg.dimensionless)  # Frequency ratio array

    weighted_p_ratio_squared = 0