@@ -21,7 +21,9 @@ def setup_class(self):
2121 """Setup default values"""
2222 self .test_turbine = {'hub_height' : 100 ,
2323 'turbine_type' : 'E-126/4200' ,
24- 'power_curve' : True }
24+ 'power_curve' : pd .DataFrame (
25+ data = {'value' : [0.0 , 4200 * 1000 ],
26+ 'wind_speed' : [0.0 , 25.0 ]})}
2527
2628 temperature_2m = np .array ([[267 ], [268 ]])
2729 temperature_10m = np .array ([[267 ], [266 ]])
@@ -303,3 +305,40 @@ def test_missing_p_values(self):
303305 test_mc = mc .ModelChain (wt .WindTurbine (** test_turbine ),
304306 ** test_modelchain )
305307 test_mc .run_model (self .weather_df )
308+
309+ def test_modelchain_with_power_curve_as_dict (self ):
310+ """Test power curves as dict"""
311+ my_turbine = {'nominal_power' : 3e6 , 'hub_height' : 105 ,
312+ 'rotor_diameter' : 70 ,
313+ 'power_curve' : {
314+ 'value' : [p * 1000 for p in [
315+ 0.0 , 26.0 , 180.0 , 1500.0 , 3000.0 , 3000.0 ]],
316+ 'wind_speed' : [0.0 , 3.0 , 5.0 , 10.0 , 15.0 , 25.0 ]},
317+ 'power_coefficient_curve' : {
318+ 'value' : [0.0 , 0.43 , 0.45 , 0.35 , 0.12 , 0.03 ],
319+ 'wind_speed' : [0.0 , 3.0 , 5.0 , 10.0 , 15.0 , 25.0 ]}}
320+ power_output_exp = pd .Series (data = [919055.54840 ,
321+ 1541786.60559 ],
322+ name = 'feedin_power_plant' )
323+ test_mc = mc .ModelChain (wt .WindTurbine (** my_turbine ))
324+ test_mc .run_model (self .weather_df )
325+ assert_series_equal (test_mc .power_output , power_output_exp )
326+
327+ def test_modelchain_with_power_coefficient_curve_as_dict (self ):
328+ """Test power coefficient curves as dict"""
329+ my_turbine = {'nominal_power' : 3e6 , 'hub_height' : 105 ,
330+ 'rotor_diameter' : 70 ,
331+ 'power_curve' : {
332+ 'value' : [p * 1000 for p in [
333+ 0.0 , 26.0 , 180.0 , 1500.0 , 3000.0 , 3000.0 ]],
334+ 'wind_speed' : [0.0 , 3.0 , 5.0 , 10.0 , 15.0 , 25.0 ]},
335+ 'power_coefficient_curve' : {
336+ 'value' : [0.0 , 0.43 , 0.45 , 0.35 , 0.12 , 0.03 ],
337+ 'wind_speed' : [0.0 , 3.0 , 5.0 , 10.0 , 15.0 , 25.0 ]}}
338+ power_output_exp = pd .Series (data = [469518.35104 ,
339+ 901794.28532 ],
340+ name = 'feedin_power_plant' )
341+ test_mc = mc .ModelChain (wt .WindTurbine (** my_turbine ),
342+ power_output_model = 'power_coefficient_curve' )
343+ test_mc .run_model (self .weather_df )
344+ assert_series_equal (test_mc .power_output , power_output_exp )
0 commit comments