Skip to content

Commit 5dbddcb

Browse files
committed
Add method to define a group of WindTurbin objects
1 parent 3e58a6a commit 5dbddcb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

windpowerlib/wind_turbine.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,16 @@ def __repr__(self):
198198

199199
return turbine_repr
200200

201+
def to_group(self, number_turbines=None, total_capacity=None):
202+
if number_turbines is not None and total_capacity is not None:
203+
raise ValueError("The 'number' and the 'total_capacity are"
204+
" mutually exclusive. Use just one of them.")
205+
elif total_capacity is not None:
206+
number_turbines = total_capacity / self.nominal_power
207+
elif number_turbines is None:
208+
number_turbines = 1
209+
return {'wind_turbine': self, 'number_of_turbines': number_turbines}
210+
201211

202212
def get_turbine_data_from_file(turbine_type, path):
203213
r"""

0 commit comments

Comments
 (0)