Conversation
With v_oc = 0 the bracket passed to find_minimum collapsed to (-1, 0, 0), breaking its x1 < x2 < x3 requirement. Where v_oc is 0, use 1 as the right end: current falls with voltage, so the bracket still holds the minimum at 0. Closes pvlib#2671 Assisted-by: Claude Opus 5
Hey @Blizzeq! 🎉Thanks for opening your first pull request! We appreciate your If AI is used for any portion of this PR, you must vet the content |
|
I don't agree with enlarging the interval by assigning a positive value to the right endpoint. That risks returning a small
|
Keeps the find_minimum bracket valid without letting v_mp exceed v_oc. Assisted-by: Claude Opus 5.5
|
Agreed, thanks. You said the same in the issue and I missed it. I measured it: with the positive right end, v_mp came back as 9.9e-17 at v_oc = 0. The bracket I pushed a change that sets v_mp and p_mp to exactly 0 wherever v_oc is 0, since 0 is the only voltage in [0, v_oc]. Those elements still get a placeholder bracket so scipy sees x1 < x2 < x3, but its result is discarded. The test now asserts v_mp == 0 exactly. |
v0.16.0 is released, so the entry for pvlib#2671 belongs to the next version. Assisted-by: Claude Opus 5.5
|
Merged main and moved the whatsnew entry to v0.16.2, since v0.16.0 is out. |
RuntimeWarning: invalid value encountered in dividewhen usingsinglediode()#2671docs/sphinx/source/whatsnewfor all changes. Includes link to the GitHub Issue with:issue:`num`or this Pull Request with:pull:`num`. Includes contributor name and/or GitHub username (link with:ghuser:`user`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.With
v_oc = 0the bracket passed tofind_minimumwas(-1, 0, 0), which breaks thex1 < x2 < x3requirement @jwhitaker-gridcog pointed at, and scipy warns from a 0/0 inside the solver. Instead of silencing the warning, the right end of the bracket is 1 whereverv_ocis 0. Current falls with voltage and is zero atv_oc, so-v*I(v)is positive on both sides of 0 and any positive right end still brackets the minimum there.Results are unchanged wherever
v_oc > 0. Atv_oc = 0you still getv_mpof about 0 andp_mp = 0, now without the warning. The new test turns warnings into errors and fails on main; it skips on scipy older than 1.15, which takes the golden section path.