Skip to main content

pvfit

PVfit: Photovoltaic (PV) Device Performance Measurement and Modeling

IMPORTANT: This code is pre-release, and so the code organiztion and Application Programming Interface (API) should be expected to change with minimal warning.

NOTICE: We are in the process of open-sourcing the single-diode equation (SDE) and single-diode model (SDM) fitting algorithms (🎉), and thus moving the related code here. The move is reasonably complete, but the code for SDM fitting using full I-V curves has not yet been ported. Likewise, the documentation badly needs updating, so for now we refer users to the demos/getting_started.py modules in the various subpackages.

CI

Code style: black

So What Can PVfit Do for Me?

PVfit is currently focused on direct-current (DC) PV module performance measurement and modeling. Following the standardized technical approach of most accredited PV calibration laboratories for measuring current-voltage (I-V) curves using reference devices, PVfit formulates it's DC performance models in terms of the effective irradiance ratio (e.g., F = Isc / Isc0 = M * Isc,ref / Isc0,ref) to quantify the effective irradiance on a PV device. This has benefits for both model calibration and performane simulation. PVfit provides extensions for working with common irradiance-based MET-station data, and PVfit also supports inference of effective-irradiance ratio and cell temperature directly from I-V measurements, see (poster). See this paper for a more detailed introduction. Email Mark Campanelli for support, etc. See the demos/getting_started.py in individual subpackages to get started with specific functionalities—

We still need to improve test coverage for certain subpackages, esp.the simple SDM.

Up and Running in 5 Minutes

pvfit minimally requires python>=3.10,<3.13 with numpy and scipy. It is tested with CPython on recent versions of Ubuntu, macOS, and Windows. We suggest using a suitable Python virtual environment that provides pip.

Download, Install, and Verify Package (non-editable mode)

This package is available at PyPI, but it is still pre-v1. With sufficiently recent versions of pip and setuptools, install pvfit with the extra packages needed for the demos using—

python -m pip install --upgrade pip setuptools
python -m pip install pvfit[demo]

Verify your installation—

python -c "from pvfit import __version__; print(__version__)"

which should print something similar to—

0.0.1

You should now be able to explore PVfit's functionality with the getting_started.py modules in the various demos directories of the various subpackages.

NOTES:

  • You may want to install your own optimized versions of numpy and scipy (e.g., using conda), otherwise this setup will grab the default versions from PyPI.
  • The demo option adds the matplotlib, pandas, and pvlib-python packages in order to run all the provided demonstrations in the demos directories.
  • You can also run pvfit on the bleeding edge. If you have git installed, then install from the main branch using—
python -m pip install --upgrade "pvfit[demo] @ git+https://github.com/markcampanelli/pvfit"

Developer Notes

Download, Install, and Verify Package with Developer and Testing Dependencies (editable mode)

Clone the repo at https://github.com/markcampanelli/pvfit using your preferred git method, and go to the repo's root directory.

Install pvfit with all extras in editable (development) mode with pip—

python -m pip install --upgrade pip setuptools
python -m pip install -e .[demo,dev,docs,test]
python -m pip install --progress-bar off "ivcurves @ git+https://github.com/cwhanse/ivcurves@7ae47284b23cfff167932b8cccae53c10ebf9bf9"

This also installs the libraries needed to test, develop the code demonstrations, and build documentation and source and wheel distributions.

Verify your installation—

python -c "from pvfit import __version__; print(__version__)"

which should print something similar to—

0.1.dev9+gadf7f38.d20190812

Next, make sure that the tests are passing.

Test with Coverage

From the root directory—

python -m pytest --doctest-modules --cov=pvfit --cov-report=html:htmlcov tests

The root of the generated coverage report is at artifacts/test/htmlcov/index.html (not committed).

Build Documentation

From the docs subdirectory—

sphinx-apidoc -f -o . ../pvfit ../*_test.py

then—

make html

The root of the generated documentation is at docs/_build/html/pvfit.html (not committed).

Distribute, inc. with Nuitka

PEP-517-compliant build is used to generate distributions using setuptools as the build backend (specified in pyproject.toml). From the repo root, execute--

python -m build

Pure-Python *.whl and *.tar.gz files are placed in the dist directory (not committed).

Alternatively, nuitka can be used to transpile the Python source code into faster-executing, compiled C code with the same Python interface. With an appropriate setup for Nuitka (compilers, etc.), swap the [build-system] table in the pyproject.toml, then--

python -m build

A platfrom-specific *.whl file is placed in the dist directory (not committed). The included Python extension module has the same interface. Users may wish to remove tests and demos before generating such wheel files.

Finally, the distribution manifests (cf. MANIFEST.in) are checked using--

python -m check_manifest

Dependencies

Currently, numpy and scipy are the only runtime dependencies. In order to ensure a straightforward, consistent, and well-tested API, the decision has been made to avoid any dependecy of the core code on pandas. However, a design goal is for straightforward integration with consumers that use pandas, e.g., integrating computations with Series and DataFrame objects. To avoid bloat, we also avoid dependency on plotting libraries such as matplotlib. Any new dependencies or version ranges should be appropriately recorded in pyproject.toml.

Coding Requirements and Style

  • Unit testing is a must, with a "collocation" scheme, i.e., module_test.py to test module.py in the same directory. 100% code coverage is the goal.
  • Type hints should be used throughout (WIP).
  • pylint is used for linting, with black's default 88-character line limit (configured in pyproject.toml). Check before committing code using--
python -m pylint .

Skip troublesome lines (sparingly) with the suffix # pylint: disable=<code>.

  • black is used to autoformat code. Autoformat before committing code, using--
python -m black .

About the Author and Maintainer

The author and maintainer of this code is Mark Campanelli, the proprietor of Intelligent Measurement Systems LLC (IMS), in Bozeman, MT, USA. Your suggestions/bug reports, questions/discussions, and contributions are welcome.

Metadata

Release files for pvfit 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pvfit 0.0.1
File Size Uploaded Provenance Actions
pvfit-0.0.1.tar.gz 127.9 kB Without provenance Details for pvfit-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pvfit 0.0.1
File Interpreter ABI Platform Actions
pvfit-0.0.1-py3-none-any.whl Python 3 none any Details for pvfit-0.0.1-py3-none-any.whl

Total release size: 272.6 kB

Release files / pvfit-0.0.1.tar.gz

Download URL pvfit-0.0.1.tar.gz
Size 127.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7e629e8860a322a703c0f1ddc1d2416ed0a940f6925ff1808cdc7c7f6b9a28ad
BLAKE2b-256 checksum
How to use checksums
9eb1a5f16b9805c45174f04202d0db7471a9a344bf6ccad43ee80eef27be863a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Release files / pvfit-0.0.1-py3-none-any.whl

Download URL pvfit-0.0.1-py3-none-any.whl
Size 144.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
42da62043426582ce9dda51955afaac35335eb327a4ef8bfacfe8bde5b814285
BLAKE2b-256 checksum
How to use checksums
f53d22c3b19db1ff47b362bacad94fba2782d0f71de5f36179993dee2c763c67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Security for pvfit 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page