Skip to content

Commit cbe1768

Browse files
Add test for exceptional case
1 parent 6175320 commit cbe1768

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

pvlib/tests/test_pvsystem.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,3 +2646,27 @@ def test_max_power_point_mismatched(inputs):
26462646
)
26472647

26482648
print(result)
2649+
2650+
def test_max_power_point_mismatched_error():
2651+
"""
2652+
Test errored max power point computation for mismatched devices in series.
2653+
"""
2654+
photocurrent = -6.2
2655+
saturation_current = 1.0e-8
2656+
resistance_series = 0.0001
2657+
resistance_shunt = 5000.0
2658+
q_C = scipy.constants.value("elementary charge")
2659+
k_B_J_per_K = scipy.constants.value("Boltzmann constant")
2660+
T_K = scipy.constants.convert_temperature(25.0, "Celsius", "Kelvin")
2661+
nNsVth = 1.1 * 60 * k_B_J_per_K * T_K / q_C
2662+
2663+
with pytest.raises(ValueError) as e_info:
2664+
pvsystem.max_power_point_mismatched(
2665+
photocurrent,
2666+
saturation_current,
2667+
resistance_series,
2668+
resistance_shunt,
2669+
nNsVth,
2670+
)
2671+
2672+
print(e_info)

0 commit comments

Comments
 (0)