Skip to content

Commit dff70e7

Browse files
committed
Density correction at end of power curve alterations (for now)
1 parent c027449 commit dff70e7

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

windpowerlib/turbine_cluster_modelchain.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ def wind_farm_power_curve(self, wind_farm, **kwargs):
132132
wind_farm : WindFarm
133133
A :class:`~.wind_farm.WindFarm` object representing the wind farm.
134134
135+
# density_df : pandas.DataFrame
136+
# DataFrame with time series for density `density` in kg/m³.
137+
# The columns of the DataFrame are a MultiIndex where the first level
138+
# contains the variable name (density) and the second level
139+
# contains the height at which it applies (e.g. 10, if it was
140+
# measured at a height of 10 m).
141+
# See :py:func:`~.run_model()` for an example on how to
142+
# create the density_df DataFrame.
143+
135144
Other Parameters
136145
----------------
137146
roughness_length : Float, optional.
@@ -166,8 +175,8 @@ def wind_farm_power_curve(self, wind_farm, **kwargs):
166175
"'turbulence_intensity' as " +
167176
"`standard_deviation_method` if " +
168177
"`turbulence_intensity` is not given")
169-
if self. density_correction:
170-
pass # TODO: restrictions (density needed)
178+
# if self. density_correction:
179+
# pass # TODO: restrictions (density needed)
171180
if self.wake_losses_method is not None:
172181
if wind_farm.efficiency is None:
173182
raise KeyError(
@@ -181,9 +190,11 @@ def wind_farm_power_curve(self, wind_farm, **kwargs):
181190
power_curve = pd.DataFrame(
182191
turbine_type_dict['wind_turbine'].power_curve)
183192
# Editions to power curve before the summation
184-
if (self.density_correction and
185-
self.density_correction_order == 'turbine_power_curves'):
186-
pass # TODO: add density correction
193+
# if (self.density_correction and
194+
# self.density_correction_order == 'turbine_power_curves'):
195+
# power_curve = power_curves.density_correct_power_curve(
196+
# density_df, power_curve['wind_speed'], # Note: density at hub height has to be passed
197+
# power_curve['power'])
187198
if (self.smoothing and
188199
self.smoothing_order == 'turbine_power_curves'):
189200
power_curve = power_curves.smooth_power_curve(
@@ -207,9 +218,12 @@ def wind_farm_power_curve(self, wind_farm, **kwargs):
207218
list(summarized_power_curve['power'].values)]).transpose()
208219
summarized_power_curve_df.columns = ['wind_speed', 'power']
209220
# Editions to power curve after the summation
210-
if (self.density_correction and
211-
self.density_correction_order == 'wind_farm_power_curves'):
212-
pass # TODO: add density correction
221+
# if (self.density_correction and
222+
# self.density_correction_order == 'wind_farm_power_curves'):
223+
# summarized_power_curve_df = (
224+
# power_curves.density_correct_power_curve(
225+
# density_df, summarized_power_curve_df['wind_speed'],
226+
# summarized_power_curve_df['power'])) # Note: density at hub height has to be passed
213227
if (self.smoothing and
214228
self.smoothing_order == 'wind_farm_power_curves'):
215229
summarized_power_curve_df = power_curves.smooth_power_curve(
@@ -414,8 +428,12 @@ def run_model(self, weather_df, **kwargs):
414428
modelchain_data = self.get_modelchain_data(**kwargs)
415429
# Density correction to cluster power curve # TODO test
416430
if (self.density_correction and
417-
self.density_correction_order == 'cluster_power_curve'):
431+
self.density_correction_order == 'wind_farm_power_curves'):
432+
# Note actually for 'cluster_power_curve'. however, probably the
433+
# density correcton will always be done at the end
418434
modelchain_data['density_correction'] = True
435+
else:
436+
modelchain_data['density_correction'] = False
419437
# Run modelchain
420438
mc = modelchain.ModelChain(
421439
self.wind_object, **modelchain_data).run_model(weather_df)

0 commit comments

Comments
 (0)