-
Notifications
You must be signed in to change notification settings - Fork 1.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
MAINT: DOC: rename singlediode module, and clean up docstring for singlediode function #525
Conversation
* closes pvlib#515 * import pvlib in pvsystem and use pvlib.singlediode to differentiate from existing pvsystem.singldiode() method already there! * rename test_singlediode_methods.py to test_singlediode.py * update documentation and comments
* closes pvlib#518 * add singlediode.rst and add to index
* proofed the docs and they are ok
okay, @wholmgren and @cwhanse can you take a look? thx |
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.
I like it. Minor comments below.
pvlib/pvsystem.py
Outdated
@@ -20,7 +20,7 @@ | |||
from pvlib.tools import _build_kwargs | |||
from pvlib.location import Location | |||
from pvlib import irradiance, atmosphere | |||
from pvlib import singlediode_methods | |||
import pvlib # FIXME: import singlediode module from pvlib |
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.
why FIXME? seems ok to me.
Something like from pvlib import singlediode as _singlediode
would work too.
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.
✅ removed fixme, replace with comment use pvlib.singlediode to avoid clash with local method
@@ -0,0 +1,104 @@ | |||
.. _singlediode: |
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.
Thanks for adding this! Perhaps it deserves its own note in the whatsnew document.
Didn't you make something else (a wiki?) with more information that might belong here?
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.
Are you set up to get readthedocs to render this version? It's pretty easy to do if you're not. Always nice to see that it works when making bigger documentation changes. If you've rendered locally and say it looks good then ok with me.
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.
Yes, there is a wiki on cell model solutions, but in order to close #518, I just need to move the section on bishop88()
out of singlediode()
, so I would like to open a separate documentation issue/pr to address moving the material appropriate from the wiki to the documents, and perhaps augmenting that with more detail as needed. Is this okay?
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.
✅ added note under documentation in what's new:
Added section on single diode equation with some detail on solutions used in
pvlib-python (:issue:518
)
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.
yes, that's ok with me.
docs/sphinx/source/singlediode.rst
Outdated
pvlib-python to generate an IV curve of a PV module. | ||
|
||
pvlib-python supports two ways to solve the single diode model, by passing the | ||
a ``method`` keyword to the :func:`pvlib.pvsystem.singlediode` function: |
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.
I suggest something like...
pvlib-python supports two ways to solve the single diode model:
The :func:pvlib.pvsystem.singlediode
function allows the user to choose the method using the method
keyword.
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.
Agree with @wholmgren here
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.
✅ nice change thx!
docs/sphinx/source/singlediode.rst
Outdated
Single Diode Model | ||
================== | ||
|
||
This section reviews the solutions to the single diode model used in |
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.
solutions to the single diode equation
here and elsewhere. Let's use "Single diode equation" when we are referring to the equation that describes a single IV curve, and "single diode model" when we are referring to the set of equations (one of which is the single diode equation) that describe IV curves at any irradiance and temperature condtion (e.g., PVsyst is a single diode model).
These are my preferred terms, and the meaning of 'model' can be debated at length without adding value. I'm pushing here for consistency and hopefully, clarity.
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.
✅ agreed, I changed all references for now to single diode equations, since I don't discuss any single diode models here yet eg: PVSyst or DeSoto
docs/sphinx/source/singlediode.rst
Outdated
:math:`f \left( w \right) = w \exp \left( w \right)` or | ||
:math:`w = f^{-1} \left( w \exp \left( w \right) \right)` also given as | ||
:math:`w = W \left( w \exp \left( w \right) \right)`. Rearranging the single | ||
diode equation above with a Lambert W-function yields the following. |
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.
I'd replace the phrase "Rearranging the single diode equation above with a Lambert W-function yields the following. " with "Defining"
Because I could not find a derivation of the Lambert W solution in literature, I wrote it out in a Sandia report. We could add a reference if you want.
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.
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 think I've reworded it using "Defining ..." is this better:
Defining the following parameter, :math:
z
, is necessary to transform the single diode equation into a form that can be expressed as a Lambert W-function.
docs/sphinx/source/singlediode.rst
Outdated
\frac{R_s \left( I_L + I_0 \right) + V}{n Ns V_{th} \left(1 + \frac{R_s}{R_{sh}}\right)} | ||
\right) | ||
|
||
The the module current can be solved using the Lambert W-function. |
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.
Then the
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.
✅ thanks
docs/sphinx/source/singlediode.rst
Outdated
current is also negative, meaning that the corresponding voltage must be | ||
in the 4th quadrant and therefore greater than the open circuit voltage | ||
(see proof below). Therefore the entire forward-bias 1st quadrant IV-curve | ||
is bounded, and a bisection search within these points will always find |
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.
please clarify "these points" I believe you mean "a bisection search for V_oc
between V_d = 0
and V_{oc, est}
"
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.
✅ I tried to make this wording better. I added between Vd and Voc,est, but the point is not just to find Voc, but to be able to find any 1st quadrant point including Voc.
docs/sphinx/source/singlediode.rst
Outdated
pvlib-python to generate an IV curve of a PV module. | ||
|
||
pvlib-python supports two ways to solve the single diode model, by passing the | ||
a ``method`` keyword to the :func:`pvlib.pvsystem.singlediode` function: |
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.
Agree with @wholmgren here
* add to what's new documentation section that there is now some detail on pvlib-python solutions to single diode equation * change single diode _model_ to single diode _equation_ everywhere to distinguish between the equation I = IL - I0*(exp(Vd/nNsVt)-1) - Vd/Rsh and implementation like PVSyst and DeSoto that derive coefficients * add reference to Cliff's Sandia Report on Lambert W-function solution of single diode equation * remove fixme in pvsystem
OK @wholmgren and @cwhanse can you take another look? thanks! |
Looks good to me. Maybe I missed it, but did you confirm that the documentation renders correctly? |
Sorry, yes I confirmed the docs render correctly |
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.
All edits are fine. Yes that’s the reference I had in mind.
Thanks Mark! |
pvlib python pull request guidelines
Thank you for your contribution to pvlib python! You may delete all of these instructions except for the list below.
You may submit a pull request with your code at any stage of completion.
The following items must be addressed before the code can be merged. Please don't hesitate to ask for help if you're unsure of how to accomplish any of the items below:
docs/sphinx/source/api.rst
for API changes.docs/sphinx/source/whatsnew
file for all changes.git diff upstream/master -u -- "*.py" | flake8 --diff
Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):
singlediode_methods.py
to justsinglediode.py
pvsystem
to full namespace to avoid clash with existing method