Skip to content

Commit

Permalink
Merge a3823ed into a338694
Browse files Browse the repository at this point in the history
  • Loading branch information
vezeli committed Dec 17, 2019
2 parents a338694 + a3823ed commit a3bb92a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_wind_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,13 @@ def test_wrongly_defined_to_group_method(self):
match="The 'number' and the 'total_capacity' "
"parameter are mutually exclusive."):
e_t_1.to_group(5, 3000)

def test_create_unphysical_turbine(self):
char = {
'hub_height': 80,
'rotor_diameter': 160,
'turbine_type': 'DUMMY 3',
'path': self.source
}
with pytest.raises(ValueError):
WindTurbine(**char)
5 changes: 5 additions & 0 deletions windpowerlib/wind_turbine.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def __init__(self, hub_height, nominal_power=None, path='oedb',
if self.rotor_diameter is None and turbine_data is not None:
self.rotor_diameter = float(turbine_data['rotor_diameter'])

if self.rotor_diameter:
if self.hub_height <= 0.5*self.rotor_diameter:
msg = "1/2*rotor_diameter cannot be higher than hub_height"
raise ValueError(msg)

if self.power_curve is None and self.power_coefficient_curve is None:
msg = ("The WindTurbine has been initialised without a power curve"
" and without a power coefficient curve.\nYou will not be"
Expand Down

0 comments on commit a3bb92a

Please sign in to comment.