@@ -985,26 +985,44 @@ def test_run_model_from_poa_tracking(sapm_dc_snl_ac_system, location,
985
985
assert_series_equal (ac , expected )
986
986
987
987
988
+ @pytest .mark .parametrize ("input_type" , [lambda x : x [0 ], tuple , list ])
988
989
def test_run_model_from_effective_irradiance (sapm_dc_snl_ac_system , location ,
989
- weather , total_irrad ):
990
+ weather , total_irrad , input_type ):
990
991
data = weather .copy ()
991
992
data [['poa_global' , 'poa_diffuse' , 'poa_direct' ]] = total_irrad
992
993
data ['effective_irradiance' ] = data ['poa_global' ]
993
994
mc = ModelChain (sapm_dc_snl_ac_system , location , aoi_model = 'no_loss' ,
994
995
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
996
997
expected = pd .Series (np .array ([149.280238 , 96.678385 ]),
997
998
index = data .index )
998
999
assert_series_equal (ac , expected )
999
1000
1000
1001
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 ])
1001
1019
def 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 ):
1003
1021
data = weather .copy ()
1004
1022
data ['effective_irradiance' ] = total_irrad ['poa_global' ]
1005
1023
mc = ModelChain (sapm_dc_snl_ac_system , location , aoi_model = 'no_loss' ,
1006
1024
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
1008
1026
expected = pd .Series (np .array ([149.280238 , 96.678385 ]),
1009
1027
index = data .index )
1010
1028
assert_series_equal (ac , expected )
@@ -1087,23 +1105,6 @@ def test_run_model_from_effective_irradiance_minimal_input(
1087
1105
assert not mc .results .ac .empty
1088
1106
1089
1107
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
-
1107
1108
def test_run_model_singleton_weather_single_array (cec_dc_snl_ac_system ,
1108
1109
location , weather ):
1109
1110
mc = ModelChain (cec_dc_snl_ac_system , location ,
0 commit comments