@@ -985,26 +985,44 @@ def test_run_model_from_poa_tracking(sapm_dc_snl_ac_system, location,
985985 assert_series_equal (ac , expected )
986986
987987
988+ @pytest .mark .parametrize ("input_type" , [lambda x : x [0 ], tuple , list ])
988989def test_run_model_from_effective_irradiance (sapm_dc_snl_ac_system , location ,
989- weather , total_irrad ):
990+ weather , total_irrad , input_type ):
990991 data = weather .copy ()
991992 data [['poa_global' , 'poa_diffuse' , 'poa_direct' ]] = total_irrad
992993 data ['effective_irradiance' ] = data ['poa_global' ]
993994 mc = ModelChain (sapm_dc_snl_ac_system , location , aoi_model = 'no_loss' ,
994995 spectral_model = 'no_loss' )
995- ac = mc .run_model_from_effective_irradiance (data ).results .ac
996+ ac = mc .run_model_from_effective_irradiance (input_type (( data ,)) ).results .ac
996997 expected = pd .Series (np .array ([149.280238 , 96.678385 ]),
997998 index = data .index )
998999 assert_series_equal (ac , expected )
9991000
10001001
1002+ @pytest .mark .parametrize ("input_type" , [tuple , list ])
1003+ def test_run_model_from_effective_irradiance_multi_array (
1004+ sapm_dc_snl_ac_system_Array , location , weather , total_irrad ,
1005+ input_type ):
1006+ data = weather .copy ()
1007+ data [['poa_global' , 'poa_diffuse' , 'poa_direct' ]] = total_irrad
1008+ data ['effective_irradiance' ] = data ['poa_global' ]
1009+ mc = ModelChain (sapm_dc_snl_ac_system_Array , location , aoi_model = 'no_loss' ,
1010+ spectral_model = 'no_loss' )
1011+ mc .run_model_from_effective_irradiance (input_type ((data , data )))
1012+ # arrays have different orientation, but should give same dc power
1013+ # because we are the same passing POA irradiance and air
1014+ # temperature.
1015+ assert_frame_equal (mc .results .dc [0 ], mc .results .dc [1 ])
1016+
1017+
1018+ @pytest .mark .parametrize ("input_type" , [lambda x : x [0 ], tuple , list ])
10011019def test_run_model_from_effective_irradiance_no_poa_global (
1002- sapm_dc_snl_ac_system , location , weather , total_irrad ):
1020+ sapm_dc_snl_ac_system , location , weather , total_irrad , input_type ):
10031021 data = weather .copy ()
10041022 data ['effective_irradiance' ] = total_irrad ['poa_global' ]
10051023 mc = ModelChain (sapm_dc_snl_ac_system , location , aoi_model = 'no_loss' ,
10061024 spectral_model = 'no_loss' )
1007- ac = mc .run_model_from_effective_irradiance (data ).results .ac
1025+ ac = mc .run_model_from_effective_irradiance (input_type (( data ,)) ).results .ac
10081026 expected = pd .Series (np .array ([149.280238 , 96.678385 ]),
10091027 index = data .index )
10101028 assert_series_equal (ac , expected )
@@ -1087,23 +1105,6 @@ def test_run_model_from_effective_irradiance_minimal_input(
10871105 assert not mc .results .ac .empty
10881106
10891107
1090- def test_run_model_from_effective_irradiance_missing_poa (
1091- sapm_dc_snl_ac_system_Array , location , total_irrad ):
1092- data_incomplete = pd .DataFrame (
1093- {'effective_irradiance' : total_irrad ['poa_global' ],
1094- 'poa_global' : total_irrad ['poa_global' ]},
1095- index = total_irrad .index )
1096- data_complete = pd .DataFrame (
1097- {'effective_irradiance' : total_irrad ['poa_global' ],
1098- 'cell_temperature' : 30 },
1099- index = total_irrad .index )
1100- mc = ModelChain (sapm_dc_snl_ac_system_Array , location )
1101- with pytest .raises (ValueError ,
1102- match = "you must provide 'poa_global' for all Arrays" ):
1103- mc .run_model_from_effective_irradiance (
1104- (data_complete , data_incomplete ))
1105-
1106-
11071108def test_run_model_singleton_weather_single_array (cec_dc_snl_ac_system ,
11081109 location , weather ):
11091110 mc = ModelChain (cec_dc_snl_ac_system , location ,
0 commit comments