Skip to content
Snippets Groups Projects
Commit 6320a202 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

add noise documentation notebook

parent d9348afd
No related branches found
No related tags found
No related merge requests found
...@@ -61,14 +61,15 @@ Lastly, the remaining notebooks illustrate some relevant examples and exercises ...@@ -61,14 +61,15 @@ Lastly, the remaining notebooks illustrate some relevant examples and exercises
:maxdepth: 1 :maxdepth: 1
:caption: Tutorials :caption: Tutorials
notebooks/Quickstart notebooks/Quickstart
notebooks/Site notebooks/Site
notebooks/WindTurbines notebooks/WindTurbines
notebooks/EngineeringWindFarmModels notebooks/EngineeringWindFarmModels
notebooks/RunWindFarmSimulation notebooks/RunWindFarmSimulation
notebooks/gradients_parallellization notebooks/gradients_parallellization
notebooks/Optimization notebooks/Optimization
notebooks/YawMisalignment notebooks/YawMisalignment
notebooks/Noise
notebooks/exercises/CombineModels notebooks/exercises/CombineModels
notebooks/exercises/Validation notebooks/exercises/Validation
notebooks/exercises/Improve_layout notebooks/exercises/Improve_layout
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -16,12 +16,13 @@ class SWT_DD_142_4100(WindTurbine): ...@@ -16,12 +16,13 @@ class SWT_DD_142_4100(WindTurbine):
""" """
def __init__(self): def __init__(self):
ds = xr.load_dataset(os.path.dirname(swt_dd_142_4100_noise.__file__) + '/SWT-DD-142_4100.nc') self.ds = ds = xr.load_dataset(os.path.dirname(swt_dd_142_4100_noise.__file__) + '/SWT-DD-142_4100.nc')
power_ct = PowerCtXr(ds, 'kW') power_ct = PowerCtXr(ds, 'kW')
ip = GridInterpolator([ds.mode.values, ds.ws.values], ds.SoundPower.transpose('mode', 'ws', 'freq').values, ip = GridInterpolator([ds.mode.values, ds.ws.values], ds.SoundPower.transpose('mode', 'ws', 'freq').values,
method=['nearest', 'linear']) method=['nearest', 'linear'])
def sound_power_level(ws, mode, **_): def sound_power_level(ws, mode, **_):
ws = np.atleast_1d(ws)
mode = np.zeros_like(ws) + mode mode = np.zeros_like(ws) + mode
return ds.freq.values, ip(np.array([np.round(mode).flatten(), ws.flatten()]).T).reshape(ws.shape + (-1,)) return ds.freq.values, ip(np.array([np.round(mode).flatten(), ws.flatten()]).T).reshape(ws.shape + (-1,))
...@@ -50,18 +51,22 @@ def make_netcdf(): ...@@ -50,18 +51,22 @@ def make_netcdf():
ds.to_netcdf('SWT-DD-142_4100.nc') ds.to_netcdf('SWT-DD-142_4100.nc')
if __name__ == '__main__': def main():
import matplotlib.pyplot as plt if __name__ == '__main__':
wt = SWT_DD_142_4100() import matplotlib.pyplot as plt
wt = SWT_DD_142_4100()
ws = np.arange(3, 26) ws = np.arange(3, 26)
for m in range(7): for m in range(7):
plt.plot(ws, wt.power(ws, mode=m) / 1000, label=f'mode: {m}') plt.plot(ws, wt.power(ws, mode=m) / 1000, label=f'mode: {m}')
setup_plot(xlabel='Wind speed [m/s]', ylabel='Power [kW]') setup_plot(xlabel='Wind speed [m/s]', ylabel='Power [kW]')
plt.figure() plt.figure()
for m in range(7): for m in range(7):
freq, sound_power = wt.sound_power(ws=10, mode=m) freq, sound_power = wt.sound_power_level(ws=10, mode=m)
plt.plot(freq, sound_power[0], label=f'mode: {m}') plt.plot(freq, sound_power[0], label=f'mode: {m}')
setup_plot(xlabel='Frequency [Hz]', ylabel='Sound power [dB]') setup_plot(xlabel='Frequency [Hz]', ylabel='Sound power [dB]')
plt.show() plt.show()
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment