Skip to content

Commit

Permalink
Add and extend docstring to show usage of 'to_group' message.
Browse files Browse the repository at this point in the history
  • Loading branch information
uvchik committed Aug 27, 2019
1 parent f22bb70 commit 2156caa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion windpowerlib/wind_farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ class WindFarm(object):
>>> print(example_farm.nominal_power)
31200000.0
>>> # turbine fleet as list of WindTurbine using the 'to_group' method.
>>> wind_turbine_fleet = [e126.to_group(number_turbines=6),
>>> wind_turbine_fleet = [e126.to_group(number_turbines=5),
... e126.to_group(),
... v90.to_group(total_capacity=3 * 2e6)]
>>> example_farm = wind_farm.WindFarm(wind_turbine_fleet)
>>> print(example_farm.nominal_power)
Expand Down
19 changes: 18 additions & 1 deletion windpowerlib/wind_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ class WindTurbine(object):
1500000.0
>>> print(e_t_1.to_group(5)['number_of_turbines'])
5
>>> print(e_t_1.to_group()['number_of_turbines'])
1
>>> print(e_t_1.to_group(number_turbines=7)['number_of_turbines'])
7
>>> print(e_t_1.to_group(total_capacity=4500000)['number_of_turbines'])
3.0
"""

def __init__(self, hub_height, nominal_power=None, path='oedb',
Expand Down Expand Up @@ -201,6 +206,18 @@ def __repr__(self):
return turbine_repr

def to_group(self, number_turbines=None, total_capacity=None):
"""
Parameters
----------
number_turbines : float
Number of turbines of the defined type.
total_capacity : float
Total capacity of the group of wind turbines of the same type.
Returns
-------
"""
if number_turbines is not None and total_capacity is not None:
raise ValueError("The 'number' and the 'total_capacity parameter "
"are mutually exclusive. Use just one of them.")
Expand Down

0 comments on commit 2156caa

Please sign in to comment.