Skip to content

Commit 451d1b1

Browse files
committed
Refactor CEC SDM fit test (pvlib#956)
1 parent 3ce8e1a commit 451d1b1

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

pvlib/tests/test_ivtools.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,19 @@ def test_fit_sdm_cec_sam(get_cec_params_cansol_cs5p_220p):
9393
modeled['R_s'] = R_s
9494
modeled['Adjust'] = Adjust
9595
assert np.allclose(modeled.values, expected.values, rtol=5e-2)
96-
# test for fitting failure
96+
97+
98+
@requires_pysam
99+
def test_fit_sdm_cec_sam_estimation_failure():
100+
"""
101+
Failing to estimate the parameters for the CEC SDM model should raise an
102+
exception.
103+
"""
97104
with pytest.raises(RuntimeError):
98-
I_L_ref, I_o_ref, R_sh_ref, R_s, a_ref, Adjust = \
99-
ivtools.fit_sdm_cec_sam(
100-
celltype='polySi', v_mp=0.45, i_mp=5.25, v_oc=0.55, i_sc=5.5,
101-
alpha_sc=0.00275, beta_voc=0.00275, gamma_pmp=0.0055,
102-
cells_in_series=1, temp_ref=25)
105+
ivtools.fit_sdm_cec_sam(
106+
celltype='polySi', v_mp=0.45, i_mp=5.25, v_oc=0.55, i_sc=5.5,
107+
alpha_sc=0.00275, beta_voc=0.00275, gamma_pmp=0.0055,
108+
cells_in_series=1, temp_ref=25)
103109

104110

105111
@requires_scipy

0 commit comments

Comments
 (0)