-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Match pvsystem.i_from_v
, v_from_i
single diode parameters with singlediode
order.
#1719
Conversation
I'm +1 on this change. It would be nice to deprecate. But I can't think of an easy way to do that for a change in the order of positional arguments. Because these functions are likely used by a small minority of pvlib users, I'd be OK with this breaking change without deprecation. |
I think this change would make the next version 0.10.0 instead of 0.9.6. Doesn't matter, just pointing it out. The only deprecation mechanism I can think of that could work here is to inspect the input and guess whether it is more likely to be a voltage or a resistance based on the range/value. We've done something similar in the past, but it's inelegant and unreliable. I'd be okay with no deprecation. For documenting, in addition to the what'snew entry, a pvlib-python/pvlib/iotools/psm3.py Lines 71 to 74 in b0ac666
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments but LGTM. Thanks @reepoi, it's great to see consistency improvements like this!
I missed updating the argument order of |
Nevermind on updating |
No need to update SingleAxisTracker IMHO. It's deprecated and only still included for legacy code while people migrate to the better alternative, so there's no need to make any changes motivated by long-term benefits (like consistent parameter ordering, for example). |
pvlib/singlediode.py
Outdated
@@ -684,7 +675,8 @@ def _pwr_optfcn(df, loc): | |||
Function to find power from ``i_from_v``. | |||
''' | |||
|
|||
I = _lambertw_i_from_v(df['r_sh'], df['r_s'], # noqa: E741, N806 | |||
df['nNsVth'], df[loc], df['i_0'], df['i_l']) | |||
I = _lambertw_i_from_v(df[loc], df['photocurrent'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to rename this internal I
here and elsewhere to mollify stickler. Not important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I renamed I
to current
. To make the rest of the code match, I changed I
to current
and V
to voltage
everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, I changed it only at the stickler comments. I
is also used as part of a variable name in many places.
2336b17
to
cbadd89
Compare
Thanks again @reepoi! |
pvsystem.i_from_v
,v_from_i
single diode parameters withsinglediode
order. #1718docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for 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.The argument order for
i_from_v
,v_from_i
is changed to:In
tests/test_singlediode.py
, the teststest_method_spr_e20_327
,test_newton_fs_495
calli_from_v
with the comment:singlediode
does get the MPP correct now, so I updated the tests to compare all returned values from thepvs
andout
variables.The test
test_newton_fs_495
passesivcurve_pnts
but then does nothing with the returnedi, v
values.Since the precision of the
i, v
values are tested below this test, I updated the test to passivcurve_pnts
asNone
.