@@ -408,29 +408,32 @@ class ModelChain:
408
408
Passed to location.get_airmass.
409
409
410
410
dc_model: None, str, or function, default None
411
- If None, the model will be inferred from the contents of
412
- system.module_parameters. Valid strings are 'sapm',
413
- 'desoto', 'cec', 'pvsyst', 'pvwatts'. The ModelChain instance will
414
- be passed as the first argument to a user-defined function.
411
+ If None, the model will be inferred from the parameters that
412
+ are common to all of system.arrays[i].module_parameters.
413
+ Valid strings are 'sapm', 'desoto', 'cec', 'pvsyst', 'pvwatts'.
414
+ The ModelChain instance will be passed as the first argument
415
+ to a user-defined function.
415
416
416
417
ac_model: None, str, or function, default None
417
- If None, the model will be inferred from the contents of
418
- system.inverter_parameters and system.module_parameters. Valid
419
- strings are 'sandia', 'adr', 'pvwatts'. The
418
+ If None, the model will be inferred from the parameters that
419
+ are common to all of system.inverter_parameters.
420
+ Valid strings are 'sandia', 'adr', 'pvwatts'. The
420
421
ModelChain instance will be passed as the first argument to a
421
422
user-defined function.
422
423
423
424
aoi_model: None, str, or function, default None
424
- If None, the model will be inferred from the contents of
425
- system.module_parameters. Valid strings are 'physical',
426
- 'ashrae', 'sapm', 'martin_ruiz', 'no_loss'. The ModelChain instance
427
- will be passed as the first argument to a user-defined function.
425
+ If None, the model will be inferred from the parameters that
426
+ are common to all of system.arrays[i].module_parameters.
427
+ Valid strings are 'physical', 'ashrae', 'sapm', 'martin_ruiz',
428
+ 'no_loss'. The ModelChain instance will be passed as the
429
+ first argument to a user-defined function.
428
430
429
431
spectral_model: None, str, or function, default None
430
- If None, the model will be inferred from the contents of
431
- system.module_parameters. Valid strings are 'sapm',
432
- 'first_solar', 'no_loss'. The ModelChain instance will be passed
433
- as the first argument to a user-defined function.
432
+ If None, the model will be inferred from the parameters that
433
+ are common to all of system.arrays[i].module_parameters.
434
+ Valid strings are 'sapm', 'first_solar', 'no_loss'.
435
+ The ModelChain instance will be passed as the first argument to
436
+ a user-defined function.
434
437
435
438
temperature_model: None, str or function, default None
436
439
Valid strings are: 'sapm', 'pvsyst', 'faiman', 'fuentes', 'noct_sam'.
@@ -691,9 +694,10 @@ def dc_model(self, model):
691
694
model = model .lower ()
692
695
if model in _DC_MODEL_PARAMS .keys ():
693
696
# validate module parameters
697
+ module_parameters = tuple (
698
+ array .module_parameters for array in self .system .arrays )
694
699
missing_params = (
695
- _DC_MODEL_PARAMS [model ] -
696
- _common_keys (self .system .module_parameters ))
700
+ _DC_MODEL_PARAMS [model ] - _common_keys (module_parameters ))
697
701
if missing_params : # some parameters are not in module.keys()
698
702
raise ValueError (model + ' selected for the DC model but '
699
703
'one or more Arrays are missing '
@@ -716,7 +720,8 @@ def dc_model(self, model):
716
720
717
721
def infer_dc_model (self ):
718
722
"""Infer DC power model from Array module parameters."""
719
- params = _common_keys (self .system .module_parameters )
723
+ params = _common_keys (
724
+ tuple (array .module_parameters for array in self .system .arrays ))
720
725
if {'A0' , 'A1' , 'C7' } <= params :
721
726
return self .sapm , 'sapm'
722
727
elif {'a_ref' , 'I_L_ref' , 'I_o_ref' , 'R_sh_ref' , 'R_s' ,
@@ -730,10 +735,11 @@ def infer_dc_model(self):
730
735
elif {'pdc0' , 'gamma_pdc' } <= params :
731
736
return self .pvwatts_dc , 'pvwatts'
732
737
else :
733
- raise ValueError ('could not infer DC model from '
734
- 'system.module_parameters. Check '
735
- 'system.module_parameters or explicitly '
736
- 'set the model with the dc_model kwarg.' )
738
+ raise ValueError (
739
+ 'Could not infer DC model from the module_parameters '
740
+ 'attributes of system.arrays. Check the module_parameters '
741
+ 'attributes or explicitly set the model with the dc_model '
742
+ 'keyword argument.' )
737
743
738
744
def sapm (self ):
739
745
dc = self .system .sapm (self .results .effective_irradiance ,
@@ -782,7 +788,7 @@ def pvwatts_dc(self):
782
788
"""Calculate DC power using the PVWatts model.
783
789
784
790
Results are stored in ModelChain.results.dc. DC power is computed
785
- from PVSystem.module_parameters['pdc0'] and then scaled by
791
+ from PVSystem.arrays[i]. module_parameters['pdc0'] and then scaled by
786
792
PVSystem.modules_per_string and PVSystem.strings_per_inverter.
787
793
788
794
Returns
@@ -891,7 +897,9 @@ def aoi_model(self, model):
891
897
self ._aoi_model = partial (model , self )
892
898
893
899
def infer_aoi_model (self ):
894
- params = _common_keys (self .system .module_parameters )
900
+ module_parameters = tuple (
901
+ array .module_parameters for array in self .system .arrays )
902
+ params = _common_keys (module_parameters )
895
903
if {'K' , 'L' , 'n' } <= params :
896
904
return self .physical_aoi_loss
897
905
elif {'B5' , 'B4' , 'B3' , 'B2' , 'B1' , 'B0' } <= params :
@@ -902,8 +910,8 @@ def infer_aoi_model(self):
902
910
return self .martin_ruiz_aoi_loss
903
911
else :
904
912
raise ValueError ('could not infer AOI model from '
905
- 'system.module_parameters. Check that the '
906
- 'module_parameters for all Arrays in '
913
+ 'system.arrays[i]. module_parameters. Check that '
914
+ 'the module_parameters for all Arrays in '
907
915
'system.arrays contain parameters for '
908
916
'the physical, aoi, ashrae or martin_ruiz model; '
909
917
'explicitly set the model with the aoi_model '
@@ -966,7 +974,9 @@ def spectral_model(self, model):
966
974
967
975
def infer_spectral_model (self ):
968
976
"""Infer spectral model from system attributes."""
969
- params = _common_keys (self .system .module_parameters )
977
+ module_parameters = tuple (
978
+ array .module_parameters for array in self .system .arrays )
979
+ params = _common_keys (module_parameters )
970
980
if {'A4' , 'A3' , 'A2' , 'A1' , 'A0' } <= params :
971
981
return self .sapm_spectral_loss
972
982
elif ((('Technology' in params or
@@ -976,8 +986,8 @@ def infer_spectral_model(self):
976
986
return self .first_solar_spectral_loss
977
987
else :
978
988
raise ValueError ('could not infer spectral model from '
979
- 'system.module_parameters. Check that the '
980
- 'module_parameters for all Arrays in '
989
+ 'system.arrays[i]. module_parameters. Check that '
990
+ 'the module_parameters for all Arrays in '
981
991
'system.arrays contain valid '
982
992
'first_solar_spectral_coefficients, a valid '
983
993
'Material or Technology value, or set '
@@ -1028,20 +1038,24 @@ def temperature_model(self, model):
1028
1038
# check system.temperature_model_parameters for consistency
1029
1039
name_from_params = self .infer_temperature_model ().__name__
1030
1040
if self ._temperature_model .__name__ != name_from_params :
1041
+ common_params = _common_keys (tuple (
1042
+ array .temperature_model_parameters
1043
+ for array in self .system .arrays ))
1031
1044
raise ValueError (
1032
1045
f'Temperature model { self ._temperature_model .__name__ } is '
1033
1046
f'inconsistent with PVSystem temperature model '
1034
1047
f'parameters. All Arrays in system.arrays must have '
1035
1048
f'consistent parameters. Common temperature model '
1036
- f'parameters: '
1037
- f'{ _common_keys (self .system .temperature_model_parameters )} '
1049
+ f'parameters: { common_params } '
1038
1050
)
1039
1051
else :
1040
1052
self ._temperature_model = partial (model , self )
1041
1053
1042
1054
def infer_temperature_model (self ):
1043
1055
"""Infer temperature model from system attributes."""
1044
- params = _common_keys (self .system .temperature_model_parameters )
1056
+ temperature_model_parameters = tuple (
1057
+ array .temperature_model_parameters for array in self .system .arrays )
1058
+ params = _common_keys (temperature_model_parameters )
1045
1059
# remove or statement in v0.9
1046
1060
if {'a' , 'b' , 'deltaT' } <= params or (
1047
1061
not params and self .system .racking_model is None
@@ -1195,7 +1209,7 @@ def _eff_irrad(module_parameters, total_irrad, spect_mod, aoi_mod):
1195
1209
self .results .spectral_modifier , self .results .aoi_modifier ))
1196
1210
else :
1197
1211
self .results .effective_irradiance = _eff_irrad (
1198
- self .system .module_parameters ,
1212
+ self .system .arrays [ 0 ]. module_parameters ,
1199
1213
self .results .total_irrad ,
1200
1214
self .results .spectral_modifier ,
1201
1215
self .results .aoi_modifier
@@ -1629,7 +1643,7 @@ def _prepare_temperature_single_array(self, data, poa):
1629
1643
self .results .cell_temperature = self ._get_cell_temperature (
1630
1644
data ,
1631
1645
poa ,
1632
- self .system .temperature_model_parameters
1646
+ self .system .arrays [ 0 ]. temperature_model_parameters
1633
1647
)
1634
1648
if self .results .cell_temperature is None :
1635
1649
self .temperature_model ()
0 commit comments