Skip to content
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

Merged
merged 5 commits into from
Aug 10, 2018

Conversation

mikofski
Copy link
Member

@mikofski mikofski commented Aug 8, 2018

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:

Brief description of the problem and proposed solution (if not already fully described in the issue linked to above):

  • rename singlediode_methods.py to just singlediode.py
  • change usage in pvsystem to full namespace to avoid clash with existing method
  • move long description of Bishop algorithm and equations to new singlediode rst-file and add to index

* 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
@mikofski
Copy link
Member Author

mikofski commented Aug 8, 2018

okay, @wholmgren and @cwhanse can you take a look? thx

Copy link
Member

@wholmgren wholmgren left a 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.

@@ -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
Copy link
Member

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.

Copy link
Member Author

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:
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

@mikofski mikofski Aug 9, 2018

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?

Copy link
Member Author

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)

Copy link
Member

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.

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:
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @wholmgren here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ nice change thx!

Single Diode Model
==================

This section reviews the solutions to the single diode model used in
Copy link
Member

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.

Copy link
Member Author

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

: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.
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

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.

\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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ thanks

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
Copy link
Member

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}"

Copy link
Member Author

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.

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:
Copy link
Member

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
@mikofski
Copy link
Member Author

OK @wholmgren and @cwhanse can you take another look? thanks!

@mikofski
Copy link
Member Author

@wholmgren
Copy link
Member

Looks good to me. Maybe I missed it, but did you confirm that the documentation renders correctly?

@mikofski
Copy link
Member Author

Sorry, yes I confirmed the docs render correctly

Copy link
Member

@cwhanse cwhanse left a 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.

@wholmgren wholmgren merged commit dc6bdbf into pvlib:master Aug 10, 2018
@wholmgren
Copy link
Member

Thanks Mark!

@mikofski mikofski deleted the singlediode_gh515_gh518 branch August 10, 2018 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants