Skip to content

Commit c44bf09

Browse files
committed
Split test and add assertion
1 parent 9a5fb8c commit c44bf09

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

tests/test_modelchain.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,26 @@ def test_missing_p_values(self):
304304
**test_modelchain)
305305
test_mc.run_model(self.weather_df)
306306

307+
def test_modelchain_with_power_curve_as_dict(self):
308+
"""Test power 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+
power_output_exp = pd.Series(data=[919055.54840,
319+
1541786.60559],
320+
name='feedin_power_plant')
321+
test_mc = mc.ModelChain(wt.WindTurbine(**my_turbine))
322+
test_mc.run_model(self.weather_df)
323+
assert_series_equal(test_mc.power_output, power_output_exp)
324+
307325
def test_modelchain_with_power_coefficient_curve_as_dict(self):
308-
"""Test power (coefficient) curves as dict"""
326+
"""Test power coefficient curves as dict"""
309327
my_turbine = {'nominal_power': 3e6, 'hub_height': 105,
310328
'rotor_diameter': 70,
311329
'power_curve': {
@@ -315,9 +333,10 @@ def test_modelchain_with_power_coefficient_curve_as_dict(self):
315333
'power_coefficient_curve': {
316334
'value': [0.0, 0.43, 0.45, 0.35, 0.12, 0.03],
317335
'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)
336+
power_output_exp = pd.Series(data=[469518.35104,
337+
901794.28532],
338+
name='feedin_power_plant')
339+
test_mc = mc.ModelChain(wt.WindTurbine(**my_turbine),
340+
power_output_model='power_coefficient_curve')
341+
test_mc.run_model(self.weather_df)
342+
assert_series_equal(test_mc.power_output, power_output_exp)

tests/test_turbine_cluster_modelchain.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ def test_tc_modelchain_with_power_curve_as_dict(self):
259259
'number_of_turbines': 3}]}
260260
my_cluster = {'wind_farms': [wf.WindFarm(**my_farm),
261261
wf.WindFarm(**self.test_farm)]}
262+
power_output_exp = pd.Series(data=[10853277.966972714,
263+
21731814.593688786],
264+
name='feedin_power_plant')
262265
# run model with my_cluster
263-
tc_mc.TurbineClusterModelChain(power_plant=wtc.WindTurbineCluster(
264-
**my_cluster)).run_model(self.weather_df)
266+
test_tc_mc = tc_mc.TurbineClusterModelChain(
267+
power_plant=wtc.WindTurbineCluster(**my_cluster))
268+
test_tc_mc.run_model(self.weather_df)
269+
assert_series_equal(test_tc_mc.power_output, power_output_exp)

0 commit comments

Comments
 (0)