Skip to content

Docstring cleanup for pvlib.ivtools #1765

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

Merged
merged 3 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions pvlib/ivtools/sde.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,

Raises
------
RuntimeError if parameter extraction is not successful.
RuntimeError
if parameter extraction is not successful.

Notes
-----
Expand Down Expand Up @@ -124,8 +125,8 @@ def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
.. math::

\log(\beta_{0} - \beta_{1} V - I)
&\approx \log(\frac{I_{0}}{1 + G_{p} R_{s}} + \frac{V}{nN_sV_{th}}
+ \frac{I R_{s}}{nN_sV_{th}}) \\
&\approx \log(\frac{I_{0}}{1 + G_{p} R_{s}}) + \frac{V}{nN_sV_{th}}
+ \frac{I R_{s}}{nN_sV_{th}} \\
&= \beta_{2} + \beta_{3} V + \beta_{4} I

6. Calculate values for ``IL, I0, Rs, Rsh,`` and ``nNsVth`` from the
Expand All @@ -139,7 +140,8 @@ def fit_sandia_simple(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
0 86758 909 4
.. [2] C. B. Jones, C. W. Hansen, "Single Diode Parameter Extraction from
In-Field Photovoltaic I-V Curves on a Single Board Computer", 46th IEEE
Photovoltaic Specialist Conference, Chicago, IL, 2019
Photovoltaic Specialist Conference, Chicago, IL, 2019.
:doi:`10.1109/PVSC40753.2019.8981330`
"""

# If not provided, extract v_oc, i_sc, v_mp and i_mp from the IV curve data
Expand Down Expand Up @@ -289,8 +291,10 @@ def _fit_sandia_cocontent(voltage, current, nsvth):

Raises
------
ValueError if ``voltage`` and ``current`` are different lengths.
ValueError if ``len(voltage)`` < 6
ValueError
if ``voltage`` and ``current`` are different lengths.
ValueError
if ``len(voltage)`` < 6

Notes
-----
Expand Down
24 changes: 15 additions & 9 deletions pvlib/ivtools/sdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,

Raises
------
ImportError if NREL-PySAM is not installed.

RuntimeError if parameter extraction is not successful.
ImportError
if NREL-PySAM is not installed.
RuntimeError
if parameter extraction is not successful.

Notes
-----
Expand All @@ -94,7 +95,7 @@ def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,
----------
.. [1] A. Dobos, "An Improved Coefficient Calculator for the California
Energy Commission 6 Parameter Photovoltaic Module Model", Journal of
Solar Energy Engineering, vol 134, 2012.
Solar Energy Engineering, vol 134, 2012. :doi:`10.1115/1.4005759`
"""

try:
Expand Down Expand Up @@ -204,7 +205,7 @@ def fit_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, cells_in_series,
----------
.. [1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.
2006. :doi:`10.1016/j.solener.2005.06.010`
"""

# Constants
Expand Down Expand Up @@ -405,18 +406,21 @@ def fit_pvsyst_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3):
.. [1] K. Sauer, T. Roessler, C. W. Hansen, Modeling the Irradiance and
Temperature Dependence of Photovoltaic Modules in PVsyst, IEEE Journal
of Photovoltaics v5(1), January 2015.
:doi:`10.1109/JPHOTOV.2014.2364133`
.. [2] A. Mermoud, PV Modules modeling, Presentation at the 2nd PV
Performance Modeling Workshop, Santa Clara, CA, May 2013
.. [3] A. Mermoud, T. Lejeuene, Performance Assessment of a Simulation
Model for PV modules of any available technology, 25th European
Photovoltaic Solar Energy Conference, Valencia, Spain, Sept. 2010
.. [4] C. Hansen, Estimating Parameters for the PVsyst Version 6
Photovoltaic Module Performance Model, Sandia National Laboratories
Report SAND2015-8598
Report SAND2015-8598. :doi:`10.2172/1223058`
.. [5] C. Hansen, Parameter Estimation for Single Diode Models of
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065.
:doi:`10.2172/1177157`
.. [6] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
:doi:`10.1109/PVSC.2013.6744135`
.. [7] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
"""

Expand Down Expand Up @@ -574,11 +578,13 @@ def fit_desoto_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3):
----------
.. [1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.
2006. :doi:`10.1016/j.solener.2005.06.010`
.. [2] C. Hansen, Parameter Estimation for Single Diode Models of
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065.
:doi:`10.2172/1177157`
.. [3] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
:doi:`10.1109/PVSC.2013.6744135`
.. [4] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
"""

Expand Down
12 changes: 6 additions & 6 deletions pvlib/ivtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ def rectify_iv_curve(voltage, current, decimals=None):
``rectify_iv_curve`` ensures that the IV curve lies in the first quadrant
of the (voltage, current) plane. The returned IV curve:

* increases in voltage
* contains no negative current or voltage values
* contains no NaNs
* contains no points with duplicate voltage values. Where voltage
values are repeated, a single data point is substituted with current
equal to the average of current at duplicated voltages.
* increases in voltage
* contains no negative current or voltage values
* contains no NaNs
* contains no points with duplicate voltage values. Where voltage
values are repeated, a single data point is substituted with current
equal to the average of current at duplicated voltages.
"""

df = pd.DataFrame(data=np.vstack((voltage, current)).T, columns=['v', 'i'])
Expand Down