Skip to main content

PVfit: Photovoltaic (PV) Device Performance Measurement and Modeling

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pvfit-0.0.1.tar.gz (127.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pvfit-0.0.1-py3-none-any.whl (144.7 kB view details)

Uploaded Python 3

File details

Details for the file pvfit-0.0.1.tar.gz.

File metadata

  • Download URL: pvfit-0.0.1.tar.gz
  • Upload date:
  • Size: 127.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for pvfit-0.0.1.tar.gz
Algorithm Hash digest
SHA256 7e629e8860a322a703c0f1ddc1d2416ed0a940f6925ff1808cdc7c7f6b9a28ad
MD5 103d7e1ea4596e617565fdc17768de90
BLAKE2b-256 9eb1a5f16b9805c45174f04202d0db7471a9a344bf6ccad43ee80eef27be863a

See more details on using hashes here.

File details

Details for the file pvfit-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pvfit-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 144.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for pvfit-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42da62043426582ce9dda51955afaac35335eb327a4ef8bfacfe8bde5b814285
MD5 8ba1c05a5d091ebd08dd6f921b685a2d
BLAKE2b-256 f53d22c3b19db1ff47b362bacad94fba2782d0f71de5f36179993dee2c763c67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page