Skip to content

Commit 388dffa

Browse files
committed
Propagate parameters on calcparams_cec call (#1215)
1 parent 40ba4bd commit 388dffa

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ Bug fixes
117117
* Reindl model fixed to generate sky_diffuse=0 when GHI=0.
118118
(:issue:`1153`, :pull:`1154`)
119119
* Update GFS product names for GFS v16. (:issue:`1202`, :pull:`1203`)
120+
* Take into account ``EgRef``, ``dEgdT``, ``irrad_ref`` and ``temp_ref`` when
121+
calling :py:func:`~pvlib.pvsystem.calcparams_cec`.
122+
(:issue:`1215`, :pull:`1216`)
120123

121124
Testing
122125
~~~~~~~

pvlib/pvsystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,8 @@ def calcparams_cec(effective_irradiance, temp_cell,
18511851
alpha_sc*(1.0 - Adjust/100),
18521852
a_ref, I_L_ref, I_o_ref,
18531853
R_sh_ref, R_s,
1854-
EgRef=1.121, dEgdT=-0.0002677,
1855-
irrad_ref=1000, temp_ref=25)
1854+
EgRef=EgRef, dEgdT=dEgdT,
1855+
irrad_ref=irrad_ref, temp_ref=temp_ref)
18561856

18571857

18581858
def calcparams_pvsyst(effective_irradiance, temp_cell,

pvlib/tests/test_pvsystem.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,43 @@ def test_calcparams_cec(cec_module_params):
807807
check_less_precise=3)
808808

809809

810+
def test_calcparams_cec_extra_params_propagation(cec_module_params, mocker):
811+
"""
812+
See bug #1215.
813+
814+
When calling `calcparams_cec`, the parameters `EgRef`, `dEgdT`, `irrad_ref`
815+
and `temp_ref` must not be ignored.
816+
817+
Since, internally, this function is calling `calcparams_desoto`, this test
818+
checks that the latter is called with the expected parameters instead of
819+
some default values.
820+
"""
821+
times = pd.date_range(start='2015-01-01', periods=3, freq='12H')
822+
effective_irradiance = pd.Series([0.0, 800.0, 800.0], index=times)
823+
temp_cell = pd.Series([25, 25, 50], index=times)
824+
extra_parameters = dict(
825+
EgRef=1.123,
826+
dEgdT=-0.0002688,
827+
irrad_ref=1100,
828+
temp_ref=23,
829+
)
830+
m = mocker.spy(pvsystem, 'calcparams_desoto')
831+
pvsystem.calcparams_cec(
832+
effective_irradiance=effective_irradiance,
833+
temp_cell=temp_cell,
834+
alpha_sc=cec_module_params['alpha_sc'],
835+
a_ref=cec_module_params['a_ref'],
836+
I_L_ref=cec_module_params['I_L_ref'],
837+
I_o_ref=cec_module_params['I_o_ref'],
838+
R_sh_ref=cec_module_params['R_sh_ref'],
839+
R_s=cec_module_params['R_s'],
840+
Adjust=cec_module_params['Adjust'],
841+
**extra_parameters,
842+
)
843+
assert m.call_count == 1
844+
assert m.call_args.kwargs == extra_parameters
845+
846+
810847
def test_calcparams_pvsyst(pvsyst_module_params):
811848
times = pd.date_range(start='2015-01-01', periods=2, freq='12H')
812849
effective_irradiance = pd.Series([0.0, 800.0], index=times)

0 commit comments

Comments
 (0)