Skip to content

Commit

Permalink
Add WindTIRose class with TI as a wind rose dimension (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsimley authored and rafmudaf committed Feb 26, 2024
1 parent af04d66 commit d3631fa
Show file tree
Hide file tree
Showing 4 changed files with 705 additions and 13 deletions.
22 changes: 20 additions & 2 deletions examples/34_wind_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import matplotlib.pyplot as plt
import numpy as np

Expand Down Expand Up @@ -44,28 +43,47 @@

# Plot the wind rose
fig, ax = plt.subplots(subplot_kw={"polar": True})
wind_rose.plot_wind_rose(ax=ax)
wind_rose.plot_wind_rose(ax=ax,legend_kwargs={"title": "WS"})
fig.suptitle("WindRose Plot")

# Now build a wind rose with turbulence intensity
wind_ti_rose = time_series.to_wind_ti_rose()

# Plot the wind rose with TI
fig, axs = plt.subplots(2, 1, figsize=(6,8), subplot_kw={"polar": True})
wind_ti_rose.plot_wind_rose(ax=axs[0], wind_rose_var="ws",legend_kwargs={"title": "WS"})
axs[0].set_title("Wind Direction and Wind Speed Frequencies")
wind_ti_rose.plot_wind_rose(ax=axs[1], wind_rose_var="ti",legend_kwargs={"title": "TI"})
axs[1].set_title("Wind Direction and Turbulence Intensity Frequencies")
fig.suptitle("WindTIRose Plots")
plt.tight_layout()

# Now set up a FLORIS model and initialize it using the time series and wind rose
fi = FlorisInterface("inputs/gch.yaml")
fi.reinitialize(layout_x=[0, 500.0], layout_y=[0.0, 0.0])

fi_time_series = fi.copy()
fi_wind_rose = fi.copy()
fi_wind_ti_rose = fi.copy()

fi_time_series.reinitialize(wind_data=time_series)
fi_wind_rose.reinitialize(wind_data=wind_rose)
fi_wind_ti_rose.reinitialize(wind_data=wind_ti_rose)

fi_time_series.calculate_wake()
fi_wind_rose.calculate_wake()
fi_wind_ti_rose.calculate_wake()

time_series_power = fi_time_series.get_farm_power()
wind_rose_power = fi_wind_rose.get_farm_power()
wind_ti_rose_power = fi_wind_ti_rose.get_farm_power()

time_series_aep = fi_time_series.get_farm_AEP_with_wind_data(time_series)
wind_rose_aep = fi_wind_rose.get_farm_AEP_with_wind_data(wind_rose)
wind_ti_rose_aep = fi_wind_ti_rose.get_farm_AEP_with_wind_data(wind_ti_rose)

print(f"AEP from TimeSeries {time_series_aep / 1e9:.2f} GWh")
print(f"AEP from WindRose {wind_rose_aep / 1e9:.2f} GWh")
print(f"AEP from WindTIRose {wind_ti_rose_aep / 1e9:.2f} GWh")

plt.show()
1 change: 1 addition & 0 deletions floris/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from .wind_data import (
TimeSeries,
WindRose,
WindTIRose,
)


Expand Down
Loading

0 comments on commit d3631fa

Please sign in to comment.