Skip to content

Commit 5304b6a

Browse files
committed
Add test for power (coefficient) curve as dict
1 parent b3ba833 commit 5304b6a

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tests/test_modelchain.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,21 @@ def test_missing_p_values(self):
303303
test_mc = mc.ModelChain(wt.WindTurbine(**test_turbine),
304304
**test_modelchain)
305305
test_mc.run_model(self.weather_df)
306+
307+
def test_modelchain_with_power_coefficient_curve_as_dict(self):
308+
"""Test power (coefficient) curves as dict"""
309+
my_turbine = {'nominal_power': 3e6, 'hub_height': 105,
310+
'rotor_diameter': 70,
311+
'power_curve': {
312+
'value': [p * 1000 for p in [
313+
0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]],
314+
'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]},
315+
'power_coefficient_curve': {
316+
'value': [0.0, 0.43, 0.45, 0.35, 0.12, 0.03],
317+
'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}}
318+
# run model with power curve
319+
mc.ModelChain(wt.WindTurbine(**my_turbine)).run_model(self.weather_df)
320+
# run model with power coefficient curve
321+
mc.ModelChain(wt.WindTurbine(**my_turbine),
322+
power_output_model='power_coefficient_curve').run_model(
323+
self.weather_df)

tests/test_turbine_cluster_modelchain.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,21 @@ def test_wind_turbine_cluster_repr_without_name(self):
244244
wf.WindFarm(**self.test_farm_2)]}
245245
assert 'Wind turbine cluster with:' in repr(
246246
wtc.WindTurbineCluster(**test_cluster))
247+
248+
def test_tc_modelchain_with_power_curve_as_dict(self):
249+
"""Test power curves as dict in TurbineClusterModelChain.run_model()"""
250+
my_turbine = {'nominal_power': 3e6, 'hub_height': 105,
251+
'power_curve': {
252+
'value': [p * 1000 for p in [
253+
0.0, 26.0, 180.0, 1500.0, 3000.0, 3000.0]],
254+
'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}}
255+
my_farm = {'wind_turbine_fleet':
256+
[{'wind_turbine': wt.WindTurbine(**my_turbine),
257+
'number_of_turbines': 3},
258+
{'wind_turbine': wt.WindTurbine(**self.test_turbine),
259+
'number_of_turbines': 3}]}
260+
my_cluster = {'wind_farms': [wf.WindFarm(**my_farm),
261+
wf.WindFarm(**self.test_farm)]}
262+
# run model with my_cluster
263+
tc_mc.TurbineClusterModelChain(power_plant=wtc.WindTurbineCluster(
264+
**my_cluster)).run_model(self.weather_df)

0 commit comments

Comments
 (0)