8000 Test pvsystem.singlediode against precisely generated IV curves by reepoi · Pull Request #1573 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Test pvsystem.singlediode against precisely generated IV curves #1573

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 29 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b92d376
start to adding tests from data in ivcurves repo
reepoi Sep 30, 2022
bebcfef
correcting Vth calculation
reepoi Oct 5, 2022
74c5f8c
making current increasing for numpy linear interp
reepoi Oct 16, 2022
85f83af
singlediode ivcurve_pnts does not give negative voltage with brentq a…
reepoi Oct 16, 2022
f165e08
adding test for singlediode log spacing methods
reepoi Oct 16, 2022
f27b97d
adding assertions for i_x and i_xx
reepoi Oct 16, 2022
64d6cef
adding i_x, i_xx iv curve data
reepoi Oct 16, 2022
8019f2c
updating whatsnew
reepoi Oct 16, 2022
2484dca
reverting changes to pvsystem.singlediode
reepoi Oct 31, 2022
dcaddc8
move precise iv curve fixtures into test_singlediode
reepoi Oct 31, 2022
3115bba
updating precise iv curve json to match new schema
reepoi Nov 17, 2022
150ee02
Merge branch 'main' of https://github.com/pvlib/pvlib-python into pre…
reepoi Nov 17, 2022
1c0f2b6
testing v_from_i, i_from_v
reepoi Nov 17, 2022
a98825e
small refactor
reepoi Nov 17, 2022
64f9c02
Merge branch 'main' of https://github.com/pvlib/pvlib-python into pre…
reepoi Dec 4, 2022
3537878
small refactor and update whatsnew
reepoi Dec 4, 2022
3670964
changing Boltzmann's constant
reepoi Dec 18, 2022
a27db19
add more to precise iv curve docstring
reepoi Dec 18, 2022
2c2ca4a
Merge branch 'main' of https://github.com/pvlib/pvlib-python into pre…
reepoi Dec 18, 2022
5178f87
Merge branch 'main' of https://github.com/pvlib/pvlib-python into pre…
reepoi Jan 10, 2023
a1040d3
use SciPy constants
reepoi Jan 10, 2023
99b9830
restore whatsnew 0.9.4
reepoi Jan 10, 2023
2471893
relax i_xx error tolerance
reepoi Jan 11, 2023
a13583b
trying lower i_xx atol
reepoi Jan 11, 2023
020e363
update generated iv curves after finding bug in their calcuation
reepoi Jan 16, 2023
be34c09
increasing i_xx atol, and adding comment about atol on mac, windows
reepoi Jan 23, 2023
e966f20
Merge branch 'main' of https://github.com/pvlib/pvlib-python into pre…
reepoi Mar 8, 2023
4b3016d
update whatsnew
reepoi Mar 8, 2023
5a6b631
update whatsnew and add references to test docs
reepoi Mar 15, 2023
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
Prev Previous commit
update whatsnew and add references to test docs
  • Loading branch information
reepoi committed Mar 15, 2023
commit 5a6b631a37cace2deeae1d99544bafce0236d8e7
7 changes: 4 additions & 3 deletions docs/sphinx/source/whatsnew/v0.9.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ Enhancements
:py:func:`pvlib.bifacial.infinite_sheds.get_irradiance_poa`
to enable use of the hay-davies sky diffuse irradiance model
instead of the default isotropic model. (:pull:`1668`)
* Testing :py:func:`pvlib.pvsystem.singlediode`, :py:func:`pvlib.pvsystem.v_from_i`,
and :py:func:`pvlib.pvsystem.i_from_v` against precisely generated IV curve data.
(:issue:`411`, :pull:`1573`)

Bug fixes
~~~~~~~~~
Expand All @@ -50,6 +47,9 @@ Testing
* Added Python 3.11 to test suite. (:pull:`1582`)
* Updated PSM3 test data files to match the new version 3.2.2 data returned
by the PSM3 API (:issue:`1591`, :pull:`1652`)
* Testing :py:func:`pvlib.pvsystem.singlediode`, :py:func:`pvlib.pvsystem.v_from_i`,
and :py:func:`pvlib.pvsystem.i_from_v` against precisely generated IV curve data.
(:issue:`411`, :pull:`1573`)


Documentation
Expand Down Expand Up @@ -77,4 +77,5 @@ Contributors
* Michael Deceglie (:ghuser:`mdeceglie`)
* Saurabh Aneja (:ghuser:`spaneja`)
* John Moseley (:ghuser:`johnMoseleyArray`)
* Mark Campanelli (:ghuser:`markcampanelli`)
* Taos Transue (:ghuser:`reepoi`)
29 changes: 19 additions & 10 deletions pvlib/tests/test_singlediode.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,15 @@ def test_newton_fs_495(method, cec_module_fs_495):

def build_precise_iv_curve_dataframe(file_csv, file_json):
"""
Reads a precise IV curve parameter set CSV and JSON to create a data frame.
Reads a precise IV curve parameter set CSV and JSON to create a DataFrame.
The CSV contains the parameters of the single diode equation which are used
to generate the JSON file data. The data are calculated using the arbitrary
precision library `mpmath`_ with 40 decimal digits of precision in order
have at least 16 decimal digits of precision when they are stored in JSON.
The precision is sufficient for the difference between the left and right
side of the single diode equation to be less than :math:`1 \times 10^{-16}`
when the numbers from the JSON are read as mpmath floats.

.. _mpmath: mpmath.org
to generate the JSON data. The data are calculated using [1]_ with 40
decimal digits of precision in order have at least 16 decimal digits of
precision when they are stored in JSON. The precision is sufficient for the
difference between the left and right side of the single diode equation to
be less than :math:`1 \times 10^{-16}` when the numbers from the JSON are
read as mpmath floats. The code to generate these IV curve data is from
[2]_. The data and tests that use this function were added in :pull:`1573`.

Parameters
----------
Expand All @@ -95,13 +94,23 @@ def build_precise_iv_curve_dataframe(file_csv, file_json):

Returns
-------
A data frame with these columns: ``Index``, ``photocurrent``,
A DataFrame with these columns: ``Index``, ``photocurrent``,
``saturation_current``, ``resistance_series``, ``resistance_shunt``,
``n``, ``cells_in_series``, ``Voltages``, ``Currents``,
``diode_voltage``, ``v_oc``, ``i_sc``, ``v_mp``, ``i_mp``, ``p_mp``,
``i_x``, ``i_xx`, ``Temperature``, ``Irradiance``, ``Sweep Direction``,
``Datetime``, ``Boltzmann``, ``Elementary Charge``, and ``Vth``. The
columns ``Irradiance``, ``Sweep Direction`` are None or empty strings.

References
----------
.. [1] The mpmath development team. (2023). mpmath: a Python library for
arbitrary-precision floating-point arithmetic (version 1.2.1).
`mpmath <mpmath.org>`_

.. [2] The ivcurves development team. (2022). Code to generate precise
solutions to the single diode equation.
`ivcurves <github.com/cwhanse/ivcurves>`_
"""
params = pd.read_csv(file_csv)
curves_metadata = pd.read_json(file_json)
Expand Down
0