8000 Propagate parameters on `calcparams_cec` call (#1215) (#1216) · RoyCoding8/pvlib-python@5b0b15a · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b0b15a

Browse files
Pequecwhanse
andauthored
Propagate parameters on calcparams_cec call (pvlib#1215) (pvlib#1216)
* Propagate parameters on `calcparams_cec` call (pvlib#1215) * Update v0.9.0.rst Remove mistaken text Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
1 parent 01a23e3 commit 5b0b15a

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ Bug fixes
163163
* Fix floating point round-off issue in
164164
:py:func:`~pvlib.irradiance.aoi_projection` (:issue:`1185`, :pull:`1191`)
165165
* Update GFS product names for GFS v16. (:issue:`1202`, :pull:`1203`)
166+
* Take into account ``EgRef``, ``dEgdT``, ``irrad_ref`` and ``temp_ref`` when
167+
calling :py:func:`~pvlib.pvsystem.calcparams_cec`. (:issue:`1215`, :pull:`1216`)
166168
* Corrected methodology error in :py:func:`~pvlib.scaling.wvm`. Tracks with
167169
fix in PVLib for MATLAB. (:issue:`1206`, :pull:`1213`)
168170

@@ -197,5 +199,6 @@ Contributors
197199
* Joshua Stein (:ghuser:`jsstein`)
198200
* Tony Lorenzo (:ghuser:`alorenzo175`)
199201
* Damjan Postolovski (:ghuser:`dpostolovski`)
202+
* Miguel Sánchez de León Peque (:ghuser:`Peque`)
200203
* Joe Ranalli (:ghuser:`jranalli`)
201204
* Chas Schweizer (:ghuser:`cpr-chas`)

pvlib/pvsystem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,8 +1994,8 @@ def calcparams_cec(effective_irradiance, temp_cell,
19941994
alpha_sc*(1.0 - Adjust/100),
19951995
a_ref, I_L_ref, I_o_ref,
19961996
R_sh_ref, R_s,
1997-
EgRef=1.121, dEgdT=-0.0002677,
1998-
irrad_ref=1000, temp_ref=25)
1997+
EgRef=EgRef, dEgdT=dEgdT,
1998+
irrad_ref=irrad_ref, temp_ref=temp_ref)
19991999

20002000

20012001
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
@@ -792,6 +792,43 @@ def test_calcparams_cec(cec_module_params):
792792
check_less_precise=3)
793793

794794

795+
def test_calcparams_cec_extra_params_propagation(cec_module_params, mocker):
796+
"""
797+
See bug #1215.
798+
799+
When calling `calcparams_cec`, the parameters `EgRef`, `dEgdT`, `irrad_ref`
800+
and `temp_ref` must not be ignored.
801+
802+
Since, internally, this function is calling `calcparams_desoto`, this test
803+
checks that the latter is called with the expected parameters instead of
804+
some default values.
805+
"""
806+
times = pd.date_range(start='2015-01-01', periods=3, freq='12H')
807+
effective_irradiance = pd.Series([0.0, 800.0, 800.0], index=times)
808+
temp_cell = pd.Series([25, 25, 50], index=times)
809+
extra_parameters = dict(
810+
EgRef=1.123,
811+
dEgdT=-0.0002688,
812+
irrad_ref=1100,
813+
temp_ref=23,
814+
)
815+
m = mocker.spy(pvsystem, 'calcparams_desoto')
816+
pvsystem.calcparams_cec(
817+
effective_irradiance=effective_irradiance,
818+
temp_cell=temp_cell,
819+
alpha_sc=cec_module_params['alpha_sc'],
820+
a_ref=cec_module_params['a_ref'],
821+
I_L_ref=cec_module_params['I_L_ref'],
822+
I_o_ref=cec_module_params['I_o_ref'],
823+
R_sh_ref=cec_module_params['R_sh_ref'],
824+
R_s=cec_module_params['R_s'],
825+
Adjust=cec_module_params['Adjust'],
826+
**extra_parameters,
827+
)
828+
assert m.call_count == 1
829+
assert m.call_args[1] == extra_parameters
830+
831+
795832
def test_calcparams_pvsyst(pvsyst_module_params):
796833
times = pd.date_range(start='2015-01-01', periods=2, freq='12H')
797834
effective_irradiance = pd.Series([0.0, 800.0], index=times)

0 commit comments

Comments
 (0)
0