Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add needed attributes to WindTurbineGroup
  • Loading branch information
uvchik committed Feb 24, 2020
commit 0965bd880d156bf96f0d0c44e2a249bd37ca5eba
28 changes: 15 additions & 13 deletions windpowerlib/wind_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,7 @@ def to_group(self, number_turbines=None, total_capacity=None):
# This is working for Python >= 3.5.
# There a cleaner solutions for Python >= 3.6, once the support of 3.5 is
# dropped: https://stackoverflow.com/a/50038614
class WindTurbineGroup(
NamedTuple(
"WindTurbineGroup",
[("wind_turbine", WindTurbine), ("number_of_turbines", float)],
)
):
class WindTurbineGroup:
"""
A simple data container to define more than one turbine of the same type.
Use the :func:`~windpowerlib.wind_turbine.WindTurbine.to_group` method to
Expand All @@ -337,15 +332,22 @@ class WindTurbineGroup(
The number of turbines. The number is not restricted to integer values.
"""

__slots__ = ()
# __slots__ = ()

def __init__(self, wind_turbine, number_of_turbines):
self.wind_turbine = wind_turbine
self.number_of_turbines = number_of_turbines
self.hub_height = self.wind_turbine.hub_height
self.nominal_power = (self.wind_turbine.nominal_power *
self.number_of_turbines)


WindTurbineGroup.wind_turbine.__doc__ = (
"A :class:`~windpowerlib.wind_farm.WindTurbine` object."
)
WindTurbineGroup.number_of_turbines.__doc__ = (
"Number of turbines of type WindTurbine"
)
# WindTurbineGroup.wind_turbine.__doc__ = (
# "A :class:`~windpowerlib.wind_farm.WindTurbine` object."
# )
# WindTurbineGroup.number_of_turbines.__doc__ = (
# "Number of turbines of type WindTurbine"
# )


def get_turbine_data_from_file(turbine_type, path):
Expand Down