Skip to content

Commit 3183cc9

Browse files
kandersolarcwhanse
andauthored
[DOC] pvsystem.singlediode math rendering (#971)
* first pass at docstring cleanup * missed a fraction * Apply suggestions from code review Co-authored-by: Cliff Hansen <[email protected]> * fix spacing issue, add seealso links * stickler * reorder docstring sections Co-authored-by: Cliff Hansen <[email protected]>
1 parent e15d464 commit 3183cc9

File tree

1 file changed

+42
-39
lines changed

1 file changed

+42
-39
lines changed

pvlib/pvsystem.py

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,60 +1958,61 @@ def sapm_effective_irradiance(poa_direct, poa_diffuse, airmass_absolute, aoi,
19581958
def singlediode(photocurrent, saturation_current, resistance_series,
19591959
resistance_shunt, nNsVth, ivcurve_pnts=None,
19601960
method='lambertw'):
1961-
"""
1962-
Solve the single-diode model to obtain a photovoltaic IV curve.
1961+
r"""
1962+
Solve the single-diode equation to obtain a photovoltaic IV curve.
19631963
1964-
Singlediode solves the single diode equation [1]_
1964+
Solves the single diode equation [1]_
19651965
19661966
.. math::
19671967
1968-
I = IL - I0*[exp((V+I*Rs)/(nNsVth))-1] - (V + I*Rs)/Rsh
1968+
I = I_L -
1969+
I_0 \left[
1970+
\exp \left(\frac{V+I R_s}{n N_s V_{th}} \right)-1
1971+
\right] -
1972+
\frac{V + I R_s}{R_{sh}}
19691973
1970-
for ``I`` and ``V`` when given ``IL, I0, Rs, Rsh,`` and ``nNsVth
1971-
(nNsVth = n*Ns*Vth)`` which are described later. Returns a DataFrame
1974+
for :math:`I` and :math:`V` when given :math:`I_L, I_0, R_s, R_{sh},` and
1975+
:math:`n N_s V_{th}` which are described later. Returns a DataFrame
19721976
which contains the 5 points on the I-V curve specified in
1973-
SAND2004-3535 [3]_. If all IL, I0, Rs, Rsh, and nNsVth are scalar, a
1974-
single curve will be returned, if any are Series (of the same
1975-
length), multiple IV curves will be calculated.
1977+
[3]_. If all :math:`I_L, I_0, R_s, R_{sh},` and
1978+
:math:`n N_s V_{th}` are scalar, a single curve is returned, if any
1979+
are Series (of the same length), multiple IV curves are calculated.
19761980
1977-
The input parameters can be calculated using calcparams_desoto from
1978-
meteorological data.
1981+
The input parameters can be calculated from meteorological data using a
1982+
function for a single diode model, e.g.,
1983+
:py:func:`~pvlib.pvsystem.calcparams_desoto`.
19791984
19801985
Parameters
19811986
----------
19821987
photocurrent : numeric
1983-
Light-generated current (photocurrent) in amperes under desired
1984-
IV curve conditions. Often abbreviated ``I_L``.
1985-
0 <= photocurrent
1988+
Light-generated current :math:`I_L` (photocurrent)
1989+
``0 <= photocurrent``. [A]
19861990
19871991
saturation_current : numeric
1988-
Diode saturation current in amperes under desired IV curve
1989-
conditions. Often abbreviated ``I_0``.
1990-
0 < saturation_current
1992+
Diode saturation :math:`I_0` current under desired IV curve
1993+
conditions. ``0 < saturation_current``. [A]
19911994
19921995
resistance_series : numeric
1993-
Series resistance in ohms under desired IV curve conditions.
1994-
Often abbreviated ``Rs``.
1995-
0 <= resistance_series < numpy.inf
1996+
Series resistance :math:`R_s` under desired IV curve conditions.
1997+
``0 <= resistance_series < numpy.inf``. [ohm]
19961998
19971999
resistance_shunt : numeric
1998-
Shunt resistance in ohms under desired IV curve conditions.
1999-
Often abbreviated ``Rsh``.
2000-
0 < resistance_shunt <= numpy.inf
2000+
Shunt resistance :math:`R_{sh}` under desired IV curve conditions.
2001+
``0 < resistance_shunt <= numpy.inf``. [ohm]
20012002
20022003
nNsVth : numeric
2003-
The product of three components. 1) The usual diode ideal factor
2004-
(n), 2) the number of cells in series (Ns), and 3) the cell
2005-
thermal voltage under the desired IV curve conditions (Vth). The
2006-
thermal voltage of the cell (in volts) may be calculated as
2007-
``k*temp_cell/q``, where k is Boltzmann's constant (J/K),
2008-
temp_cell is the temperature of the p-n junction in Kelvin, and
2009-
q is the charge of an electron (coulombs).
2010-
0 < nNsVth
2004+
The product of three components: 1) the usual diode ideality factor
2005+
:math:`n`, 2) the number of cells in series :math:`N_s`, and 3)
2006+
the cell thermal voltage
2007+
:math:`V_{th}`. The thermal voltage of the cell (in volts) may be
2008+
calculated as :math:`k_B T_c / q`, where :math:`k_B` is
2009+
Boltzmann's constant (J/K), :math:`T_c` is the temperature of the p-n
2010+
junction in Kelvin, and :math:`q` is the charge of an electron
2011+
(coulombs). ``0 < nNsVth``. [V]
20112012
20122013
ivcurve_pnts : None or int, default None
2013-
Number of points in the desired IV curve. If None or 0, no
2014-
IV curves will be produced.
2014+
Number of points in the desired IV curve. If None or 0, no points on
2015+
the IV curves will be produced.
20152016
20162017
method : str, default 'lambertw'
20172018
Determines the method used to calculate points on the IV curve. The
@@ -2043,6 +2044,14 @@ def singlediode(photocurrent, saturation_current, resistance_series,
20432044
The output will be a DataFrame if photocurrent is a Series and
20442045
ivcurve_pnts is None.
20452046
2047+
See also
2048+
--------
2049+
calcparams_desoto
2050+
calcparams_cec
2051+
calcparams_pvsyst
2052+
sapm
2053+
pvlib.singlediode.bishop88
2054+
20462055
Notes
20472056
-----
20482057
If the method is ``'lambertw'`` then the solution employed to solve the
@@ -2079,12 +2088,6 @@ def singlediode(photocurrent, saturation_current, resistance_series,
20792088
.. [4] "Computer simulation of the effects of electrical mismatches in
20802089
photovoltaic cell interconnection circuits" JW Bishop, Solar Cell (1988)
20812090
https://doi.org/10.1016/0379-6787(88)90059-2
2082-
2083-
See also
2084-
--------
2085-
sapm
2086-
calcparams_desoto
2087-
pvlib.singlediode.bishop88
20882091
"""
20892092
# Calculate points on the IV curve using the LambertW solution to the
20902093
# single diode equation

0 commit comments

Comments
 (0)