-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
611f409
MAINT: rename singlediode_methods.py to just singlediode.py
mikofski 1a42153
DOC: move proof that estimated Voc is in q4
mikofski a49e959
DOC: add DOI to Jain and Kapoor
mikofski 1b024e1
DOC: MAINT: improve wording in singlediode.rst
mikofski fa03a93
DOC: MAINT: fix citation for Sandia Report, remove extra parentheses
mikofski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ Contents | |
api | ||
comparison_pvlib_matlab | ||
variables_style_rules | ||
singlediode | ||
|
||
|
||
Indices and tables | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
.. _singlediode: | ||
|
||
Single Diode Equation | ||
===================== | ||
|
||
This section reviews the solutions to the single diode equation used in | ||
pvlib-python to generate an IV curve of a PV module. | ||
|
||
pvlib-python supports two ways to solve the single diode equation: | ||
|
||
1. Lambert W-Function | ||
2. Bishop's Algorithm | ||
|
||
The :func:`pvlib.pvsystem.singlediode` function allows the user to choose the | ||
method using the ``method`` keyword. | ||
|
||
Lambert W-Function | ||
------------------ | ||
When ``method='lambertw'``, the Lambert W-function is used as previously shown | ||
by Jain, Kapoor [1, 2] and Hansen [3]. The following algorithm can be found on | ||
`Wikipedia: Theory of Solar Cells | ||
<https://en.wikipedia.org/wiki/Theory_of_solar_cells>`_, given the basic single | ||
diode model equation. | ||
|
||
.. math:: | ||
|
||
I = I_L - I_0 \left(\exp \left(\frac{V + I R_s}{n Ns V_{th}} \right) - 1 \right) | ||
- \frac{V + I R_s}{R_{sh}} | ||
|
||
Lambert W-function is the inverse of the function | ||
: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)`. 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. | ||
|
||
.. math:: | ||
|
||
z = \frac{R_s I_0}{n Ns V_{th} \left(1 + \frac{R_s}{R_{sh}} \right)} \exp \left( | ||
\frac{R_s \left( I_L + I_0 \right) + V}{n Ns V_{th} \left(1 + \frac{R_s}{R_{sh}}\right)} | ||
\right) | ||
|
||
Then the module current can be solved using the Lambert W-function, | ||
:math:`W \left(z \right)`. | ||
|
||
.. math:: | ||
|
||
I = \frac{I_L + I_0 - \frac{V}{R_{sh}}}{1 + \frac{R_s}{R_{sh}}} | ||
- \frac{n Ns V_{th}}{R_s} W \left(z \right) | ||
|
||
|
||
Bishop's Algorithm | ||
------------------ | ||
The function :func:`pvlib.singlediode.bishop88` uses an explicit solution [4] | ||
that finds points on the IV curve by first solving for pairs :math:`(V_d, I)` | ||
where :math:`V_d` is the diode voltage :math:`V_d = V + I*Rs`. Then the voltage | ||
is backed out from :math:`V_d`. Points with specific voltage, such as open | ||
circuit, are located using the bisection search method, ``brentq``, bounded | ||
by a zero diode voltage and an estimate of open circuit voltage given by | ||
|
||
.. math:: | ||
|
||
V_{oc, est} = n Ns V_{th} \log \left( \frac{I_L}{I_0} + 1 \right) | ||
|
||
We know that :math:`V_d = 0` corresponds to a voltage less than zero, and | ||
we can also show that when :math:`V_d = V_{oc, est}`, the resulting | ||
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 because :math:`V_{oc} < V_{oc, est}`, and so a bisection search | ||
between 0 and :math:`V_{oc, est}` will always find any desired condition in the | ||
1st quadrant including :math:`V_{oc}`. | ||
|
||
.. math:: | ||
|
||
I = I_L - I_0 \left(\exp \left(\frac{V_{oc, est}}{n Ns V_{th}} \right) - 1 \right) | ||
- \frac{V_{oc, est}}{R_{sh}} \newline | ||
|
||
I = I_L - I_0 \left(\exp \left(\frac{n Ns V_{th} \log \left(\frac{I_L}{I_0} + 1 \right)}{n Ns V_{th}} \right) - 1 \right) | ||
- \frac{n Ns V_{th} \log \left(\frac{I_L}{I_0} + 1 \right)}{R_{sh}} \newline | ||
|
||
I = I_L - I_0 \left(\exp \left(\log \left(\frac{I_L}{I_0} + 1 \right) \right) - 1 \right) | ||
- \frac{n Ns V_{th} \log \left(\frac{I_L}{I_0} + 1 \right)}{R_{sh}} \newline | ||
|
||
I = I_L - I_0 \left(\frac{I_L}{I_0} + 1 - 1 \right) | ||
- \frac{n Ns V_{th} \log \left(\frac{I_L}{I_0} + 1 \right)}{R_{sh}} \newline | ||
|
||
I = I_L - I_0 \left(\frac{I_L}{I_0} \right) | ||
- \frac{n Ns V_{th} \log \left(\frac{I_L}{I_0} + 1 \right)}{R_{sh}} \newline | ||
|
||
I = I_L - I_L - \frac{n Ns V_{th} \log \left( \frac{I_L}{I_0} + 1 \right)}{R_{sh}} \newline | ||
|
||
I = - \frac{n Ns V_{th} \log \left( \frac{I_L}{I_0} + 1 \right)}{R_{sh}} | ||
|
||
References | ||
---------- | ||
[1] "Exact analytical solutions of the parameters of real solar cells using | ||
Lambert W-function," A. Jain, A. Kapoor, Solar Energy Materials and Solar Cells, | ||
81, (2004) pp 269-277. | ||
:doi:`10.1016/j.solmat.2003.11.018` | ||
|
||
[2] "A new method to determine the diode ideality factor of real solar cell | ||
using Lambert W-function," A. Jain, A. Kapoor, Solar Energy Materials and Solar | ||
Cells, 85, (2005) 391-396. | ||
:doi:`10.1016/j.solmat.2004.05.022` | ||
|
||
[3] "Parameter Estimation for Single Diode Models of Photovoltaic Modules," | ||
Clifford W. Hansen, Sandia `Report SAND2015-2065 | ||
<https://prod.sandia.gov/techlib-noauth/access-control.cgi/2015/152065.pdf>`_, | ||
2015 :doi:`10.13140/RG.2.1.4336.7842` | ||
|
||
[4] "Computer simulation of the effects of electrical mismatches in | ||
photovoltaic cell interconnection circuits" JW Bishop, Solar Cell (1988) | ||
:doi:`10.1016/0379-6787(88)90059-2` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofsinglediode()
, 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:
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.