Skip to content

Refactor CEC SDM fit test (#956) #957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions pvlib/tests/test_ivtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,19 @@ def test_fit_sdm_cec_sam(get_cec_params_cansol_cs5p_220p):
modeled['R_s'] = R_s
modeled['Adjust'] = Adjust
assert np.allclose(modeled.values, expected.values, rtol=5e-2)
# test for fitting failure


@requires_pysam
def test_fit_sdm_cec_sam_estimation_failure():
"""
Failing to estimate the parameters for the CEC SDM model should raise an
exception.
"""
with pytest.raises(RuntimeError):
I_L_ref, I_o_ref, R_sh_ref, R_s, a_ref, Adjust = \
ivtools.fit_sdm_cec_sam(
celltype='polySi', v_mp=0.45, i_mp=5.25, v_oc=0.55, i_sc=5.5,
alpha_sc=0.00275, beta_voc=0.00275, gamma_pmp=0.0055,
cells_in_series=1, temp_ref=25)
ivtools.fit_sdm_cec_sam(
celltype='polySi', v_mp=0.45, i_mp=5.25, v_oc=0.55, i_sc=5.5,
alpha_sc=0.00275, beta_voc=0.00275, gamma_pmp=0.0055,
cells_in_series=1, temp_ref=25)


@requires_scipy
Expand Down