Skip to content

Commit e5479ae

Browse files
committed
Add to docstrings and headers
1 parent 0a5a7d8 commit e5479ae

File tree

4 files changed

+62
-42
lines changed

4 files changed

+62
-42
lines changed

windpowerlib/power_curves.py

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
The ``power_curves`` module contains functions for applying calculations to the
2+
The ``power_curves`` module contains functions for applying alterations to the
33
power curve of a wind turbine, wind farm or wind turbine cluster.
44
55
"""
@@ -17,7 +17,7 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
1717
standard_deviation_method='turbulence_intensity',
1818
mean_gauss=0, **kwargs):
1919
r"""
20-
Smoothes the input power curve values by using a gaussian distribution.
20+
Smoothes the input power curve values by using a Gauss distribution.
2121
2222
Parameters
2323
----------
@@ -27,18 +27,24 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
2727
power_curve_values : pandas.Series or numpy.array
2828
Power curve values corresponding to wind speeds in
2929
`power_curve_wind_speeds`.
30-
block_width : Float
30+
block_width : float
3131
Width of the moving block. Default: 0.5.
32-
standard_deviation_method : String
33-
Method for calculating the standard deviation for the gaussian
32+
wind_speed_range : float
33+
The sum in the equation below is taken for this wind speed range below
34+
and above the power curve wind speed. Default: 15.0.
35+
standard_deviation_method : string
36+
Method for calculating the standard deviation for the Gauss
3437
distribution. Options: 'turbulence_intensity', 'Staffell_Pfenninger'.
3538
Default: 'turbulence_intensity'.
39+
mean_gauss : float or integer
40+
Mean of the Gaus distribution in
41+
:py:func:`~.tools.gaussian_distribution`:. Default: 0.
3642
3743
Other Parameters
3844
----------------
39-
turbulence intensity : Float, optional
40-
Turbulence intensity at hub height of the wind turbine the power curve
41-
is smoothed for.
45+
turbulence intensity : float, optional
46+
Turbulence intensity at hub height of the wind turbine, wind farm or
47+
wind turbine cluster the power curve is smoothed for.
4248
4349
Returns
4450
-------
@@ -49,17 +55,36 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
4955
5056
Notes
5157
-----
52-
The following equation is used [1]_:
53-
# TODO: add equation
58+
The following equation is used to calculated the power curves values of the
59+
smoothed power curve [1]_:
60+
P_{smoothed}(v_{std}) = \sum\limits_{v_i}^{} \Delta v_i \cdot P(v_i)
61+
\cdot \frac{1}{\sigma \sqrt{2 \pi}}
62+
\exp \left[-\frac{(v_{std} - v_i -\mu)^2}{2 \sigma^2} \right]
63+
64+
with:
65+
P: power [W], v: wind speed [m/s],
66+
:math:`\sigma`: standard deviation (Gauss), :math: `\mu`: mean (Gauss),
67+
68+
:math:`P_{smoothed}` is the smoothed power curve value,
69+
:math:`v_{std}` is the standard wind speed in the power curve,
70+
:math: `\Delta v_i` is the interval length between
71+
:math: `$v_\text{i}$` and :math: `$v_\text{i+1}$`
72+
73+
This way of smoothing power curves is also used in [2]_ and [3]_.
5474
5575
References
5676
----------
5777
.. [1] Knorr, K.: "Modellierung von raum-zeitlichen Eigenschaften der
5878
Windenergieeinspeisung für wetterdatenbasierte
5979
Windleistungssimulationen". Universität Kassel, Diss., 2016,
6080
p. 106
81+
.. [2] Nørgaard, P. and Holttinen, H.: "A Multi-Turbine and Power Curve
82+
Approach". Nordic Wind Power Conference, 1.–2.3.2004, 2000
83+
.. [3] Kohler, S. and Agricola, A.-Cl. and Seidl, H.:
84+
"dena-Netzstudie II. Integration erneuerbarer Energien in die
85+
deutsche Stromversorgung im Zeitraum 2015 – 2020 mit Ausblick
86+
2025". Technical report, 2010.
6187
62-
# TODO: add references
6388
"""
6489
# Specify normalized standard deviation
6590
if standard_deviation_method == 'turbulence_intensity':
@@ -88,7 +113,7 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
88113
wind_speed_range + block_width,
89114
block_width) +
90115
power_curve_wind_speed)
91-
# Get standard deviation for gaussian filter
116+
# Get standard deviation for Gauss function
92117
standard_deviation = (
93118
(power_curve_wind_speed * normalized_standard_deviation + 0.6)
94119
if standard_deviation_method is 'Staffell_Pfenninger'
@@ -102,7 +127,7 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
102127
standard_deviation, mean_gauss)
103128
for wind_speed in wind_speeds_block)
104129
# Add value to list - add 0 if `smoothed_value` is nan. This occurs
105-
# because the gaussian distribution is not defined for 0.
130+
# because the Gauss distribution is not defined for 0.
106131
smoothed_power_curve_values.append(0 if np.isnan(smoothed_value)
107132
else smoothed_value)
108133
# Create smoothed power curve DataFrame
@@ -115,10 +140,10 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
115140

116141

117142
def wake_losses_to_power_curve(power_curve_wind_speeds, power_curve_values,
118-
wake_losses_model='power_efficiency_curve',
119-
wind_farm_efficiency=None):
143+
wind_farm_efficiency,
144+
wake_losses_model='power_efficiency_curve'):
120145
r"""
121-
Applies wake losses depending on the method to a power curve.
146+
Reduces the power values of a power curve by an efficiency (curve).
122147
123148
Parameters
124149
----------
@@ -128,27 +153,23 @@ def wake_losses_to_power_curve(power_curve_wind_speeds, power_curve_values,
128153
power_curve_values : pandas.Series or numpy.array
129154
Power curve values corresponding to wind speeds in
130155
`power_curve_wind_speeds`.
156+
wind_farm_efficiency : float or pd.DataFrame
157+
Efficiency of the wind farm. Either constant (float) or efficiency
158+
curve (pd.DataFrame) containing 'wind_speed' and 'efficiency' columns
159+
with wind speeds in m/s and the corresponding dimensionless wind farm
160+
efficiency (reduction of power).
161+
Default: None.
131162
wake_losses_model : String
132163
Defines the method for talking wake losses within the farm into
133164
consideration. Options: 'power_efficiency_curve',
134165
'constant_efficiency'. Default: 'power_efficiency_curve'.
135-
wind_farm_efficiency : Float or pd.DataFrame or Dictionary
136-
Efficiency of the wind farm. Either constant (float) or efficiency
137-
curve (pd.DataFrame or Dictionary) containing 'wind_speed' and
138-
'efficiency' columns/keys with wind speeds in m/s and the
139-
corresponding dimensionless wind farm efficiency (reduction of power).
140-
Default: None.
141166
142167
Returns
143168
-------
144169
power_curve_df : pd.DataFrame
145-
With wind farm efficiency reduced power curve. DataFrame has
146-
'wind_speed' and 'power' columns with wind speeds in m/s and the
147-
corresponding power curve value in W.
148-
149-
Notes
150-
-----
151-
TODO add
170+
Power curve with power values reduced by a wind farm efficiency.
171+
DataFrame has 'wind_speed' and 'power' columns with wind speeds in m/s
172+
and the corresponding power curve value in W.
152173
153174
"""
154175
# Create power curve DataFrame

windpowerlib/tools.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,16 @@ def logarithmic_interpolation_extrapolation(df, target_height):
129129

130130
def gaussian_distribution(function_variable, standard_deviation, mean=0):
131131
r"""
132-
Normal distribution or gaussian distribution.
132+
Gauss distribution.
133133
134134
Parameters
135135
----------
136-
function_variable : Float
136+
function_variable : float
137137
Variable of the gaussian distribution.
138-
standard_deviation : Float
139-
Standard deviation of the gaussian distribution.
138+
standard_deviation : float
139+
Standard deviation of the Gauss distribution.
140140
mean : Float
141-
Defines the offset of the gaussian distribution function. Default: 0.
141+
Defines the offset of the Gauss distribution. Default: 0.
142142
143143
Returns
144144
-------
@@ -150,10 +150,10 @@ def gaussian_distribution(function_variable, standard_deviation, mean=0):
150150
The following equation is used [1]_:
151151
152152
.. math:: f(x) = \frac{1}{\sigma \sqrt{2 \pi}} exp
153-
\left[ -\frac{(x-\mu)^2}{2 \sigma^2} \right]
153+
\left[-\frac{(x-\mu)^2}{2 \sigma^2} \right]
154154
155155
with:
156-
# TODO: add variables
156+
:math:`\sigma`: standard deviation, :math: `\mu`: mean
157157
158158
References
159159
----------

windpowerlib/turbine_cluster_modelchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
The ``turbine_cluster_modelchain`` module contains functions and classes of the
3-
windpowerlib. TODO: adapt
3+
windpowerlib.
44
55
"""
66

windpowerlib/wind_farm.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,10 @@ def assign_power_curve(self, wake_losses_model='power_efficiency_curve',
132132
r"""
133133
Calculates the power curve of a wind farm.
134134
135-
The wind farm power curve is calculated by aggregating the wind turbine
136-
power curves of the wind farm.
137-
Depending on the parameters the wind turbine power curves are smoothed
138-
before or after the summation and/or a wind farm efficiency is applied
139-
after the summation. TODO: check entry
135+
The wind farm power curve is calculated by aggregating the power curves
136+
of all wind turbines in the wind farm. Depending on the parameters the
137+
wind turbine power curves are smoothed before or after the summation
138+
and/or a wind farm efficiency is applied after the summation.
140139
141140
Parameters
142141
----------

0 commit comments

Comments
 (0)