pvfactors


Namepvfactors JSON
Version 1.5.2 PyPI version JSON
download
home_pagehttps://github.com/SunPower/pvfactors
Summary2D View Factor Model to calculate the irradiance incident on various surfaces of PV arrays
upload_time2022-02-24 19:41:35
maintainer
docs_urlNone
authorSunPower
requires_python
licenseBSD 3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pvfactors: irradiance modeling made simple
==========================================

|Logo|

|CircleCI|  |License|  |PyPI-Status|  |PyPI-Versions|

pvfactors is a tool used by PV professionals to calculate the
irradiance incident on surfaces of a photovoltaic array. It relies on the use of
2D geometries and view factors integrated mathematically into systems of
equations to account for reflections between all of the surfaces.

pvfactors was originally ported from the SunPower developed 'vf_model' package, which was introduced at the IEEE PV Specialist Conference 44 2017 (see [#pvfactors_paper]_ and link_ to paper).

------------------------------------------

.. contents:: Table of contents
   :backlinks: top
   :local:


Documentation
-------------

The documentation can be found `here <https://sunpower.github.io/pvfactors>`_.
It includes a lot of tutorials_ that describe the different ways of using pvfactors.


Quick Start
-----------

Given some timeseries inputs:


.. code:: python

   # Import external libraries
   from datetime import datetime
   import pandas as pd

   # Create input data
   df_inputs = pd.DataFrame(
       {'solar_zenith': [20., 50.],
        'solar_azimuth': [110., 250.],
        'surface_tilt': [10., 20.],
        'surface_azimuth': [90., 270.],
        'dni': [1000., 900.],
        'dhi': [50., 100.],
        'albedo': [0.2, 0.2]},
       index=[datetime(2017, 8, 31, 11), datetime(2017, 8, 31, 15)])
   df_inputs


+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+
|                     | solar_zenith | solar_azimuth | surface_tilt | surface_azimuth | dni    | dhi   | albedo |
+=====================+==============+===============+==============+=================+========+=======+========+
| 2017-08-31 11:00:00 | 20.0         | 110.0         | 10.0         | 90.0            | 1000.0 | 50.0  | 0.2    |
+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+
| 2017-08-31 15:00:00 | 50.0         | 250.0         | 20.0         | 270.0           | 900.0  | 100.0 | 0.2    |
+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+


And some PV array parameters


.. code:: python

   pvarray_parameters = {
       'n_pvrows': 3,            # number of pv rows
       'pvrow_height': 1,        # height of pvrows (measured at center / torque tube)
       'pvrow_width': 1,         # width of pvrows
       'axis_azimuth': 0.,       # azimuth angle of rotation axis
       'gcr': 0.4,               # ground coverage ratio
   }

The user can quickly create a PV array with ``pvfactors``, and manipulate it with the engine


.. code:: python

   from pvfactors.geometry import OrderedPVArray
   # Create PV array
   pvarray = OrderedPVArray.init_from_dict(pvarray_parameters)



.. code:: python

   from pvfactors.engine import PVEngine
   # Create engine
   engine = PVEngine(pvarray)
   # Fit engine to data
   engine.fit(df_inputs.index, df_inputs.dni, df_inputs.dhi,
              df_inputs.solar_zenith, df_inputs.solar_azimuth,
              df_inputs.surface_tilt, df_inputs.surface_azimuth,
              df_inputs.albedo)

The user can then plot the PV array geometry at any given time of the simulation:


.. code:: python

   # Plot pvarray shapely geometries
   f, ax = plt.subplots(figsize=(10, 5))
   pvarray.plot_at_idx(1, ax)
   plt.show()

.. image:: https://raw.githubusercontent.com/SunPower/pvfactors/master/docs/sphinx/_static/pvarray.png


It is then very easy to run simulations using the defined engine:


.. code:: python

    pvarray = engine.run_full_mode(fn_build_report=lambda pvarray: pvarray)


And inspect the results thanks to the simple geometry API


.. code:: python

    print("Incident irradiance on front surface of middle pv row: {} W/m2"
          .format(pvarray.ts_pvrows[1].front.get_param_weighted('qinc')))
    print("Reflected irradiance on back surface of left pv row: {} W/m2"
          .format(pvarray.ts_pvrows[0].back.get_param_weighted('reflection')))
    print("Isotropic irradiance on back surface of right pv row: {} W/m2"
          .format(pvarray.ts_pvrows[2].back.get_param_weighted('isotropic')))


.. parsed-literal::

    Incident irradiance on front surface of middle pv row: [1034.968  886.377] W/m2
    Reflected irradiance on back surface of left pv row: [112.139  86.404] W/m2
    Isotropic irradiance on back surface of right pv row: [0.116 1.849] W/m2


The users can also create a "report" while running the simulations that will rely on the simple API shown above, and which will look like whatever the users want.

.. code:: python

    # Create a function that will build a report
    def fn_report(pvarray): return {'total_incident_back': pvarray.ts_pvrows[1].back.get_param_weighted('qinc'),
                                    'total_absorbed_back': pvarray.ts_pvrows[1].back.get_param_weighted('qabs')}

    # Run full mode simulation
    report = engine.run_full_mode(fn_build_report=fn_report)

    # Print results (report is defined by report function passed by user)
    df_report = pd.DataFrame(report, index=df_inputs.index)
    df_report


+---------------------+---------------------+---------------------+
|                     | total_incident_back | total_absorbed_back |
+=====================+=====================+=====================+
| 2017-08-31 11:00:00 |          106.627832 |          103.428997 |
+---------------------+---------------------+---------------------+
| 2017-08-31 15:00:00 |          79.668878  |           77.278812 |
+---------------------+---------------------+---------------------+



Installation
------------

pvfactors is currently compatible and tested with 3.6+, and is available in `PyPI <https://pypi.org/project/pvfactors/>`_. The easiest way to install pvfactors is to use pip_ as follows:

.. code:: sh

    $ pip install pvfactors

The package wheel files are also available in the `release section`_ of the Github repository.


Requirements
------------

Requirements are included in the ``requirements.txt`` file of the package. Here is a list of important dependencies:

* `numpy <https://pypi.python.org/pypi/numpy>`_
* `pvlib-python <https://pypi.python.org/pypi/pvlib>`_
* `shapely <https://pypi.python.org/pypi/Shapely>`_


Citing pvfactors
----------------

We appreciate your use of pvfactors. If you use pvfactors in a published work, we kindly ask that you cite:


.. parsed-literal::

   Anoma, M., Jacob, D., Bourne, B.C., Scholl, J.A., Riley, D.M. and Hansen, C.W., 2017. View Factor Model and Validation for Bifacial PV and Diffuse Shade on Single-Axis Trackers. In 44th IEEE Photovoltaic Specialist Conference.


Contributing
------------

Contributions are needed in order to improve pvfactors.
If you wish to contribute, you can start by forking and cloning the repository, and then installing pvfactors using pip_ in the root folder of the package:

.. code:: sh

    $ pip install .


To install the package in editable mode, you can use:

.. code:: sh

    $ pip install -e .

Releasing
+++++++++

When releasing pvfactors, you will need to run a couple of build commands. First make sure to activate your virtual environment if any, then:

- create a tag on the latest master branch commit using `git tag -a vX.X.X`, and write a tag message. You can then push that tag to Github so that it will appear there.
- build the documentation by running `make build-docs`. When done running, you should be able to open `build/sphinx/html/index.html`, and confirm that the version displayed is the same as the one from the git tag. You can deploy by copying the content of of the `build/sphinx/html/` folder into the `gh-pages` branch of the repo (make sure to keep the `.nojekyll` file that's already present).
- build the release files by running `make build-package`. When done running, you should be able to open `dist/` and see both a whl file and and tar file. Make sure that their names include the correct git tag you created. Please confirm that the whl file was built correctly by installing it locally and testing the newly released updates. You can deploy by 1) making a Github release from the tag you created and pushed, and including the files in `dist/` in the release. 2) The last step is to publish a release in PyPI, for which you can use twine and the command `twine upload dist/*`




References
----------

.. [#pvfactors_paper] Anoma, M., Jacob, D., Bourne, B. C., Scholl, J. A., Riley, D. M., & Hansen, C. W. (2017). View Factor Model and Validation for Bifacial PV and Diffuse Shade on Single-Axis Trackers. In 44th IEEE Photovoltaic Specialist Conference.


.. _link: https://pdfs.semanticscholar.org/ebb2/35e3c3796b158e1a3c45b40954e60d876ea9.pdf

.. _tutorials: https://sunpower.github.io/pvfactors/tutorials/index.html

.. _`full mode`: https://sunpower.github.io/pvfactors/theory/problem_formulation.html#full-simulations

.. _`fast mode`: https://sunpower.github.io/pvfactors/theory/problem_formulation.html#fast-simulations

.. _pip: https://pip.pypa.io/en/stable/

.. _`release section`: https://github.com/SunPower/pvfactors/releases

.. |Logo| image:: https://raw.githubusercontent.com/SunPower/pvfactors/master/docs/sphinx/_static/logo.png
          :target: http://sunpower.github.io/pvfactors/

.. |CircleCI| image:: https://circleci.com/gh/SunPower/pvfactors.svg?style=shield
              :target: https://circleci.com/gh/SunPower/pvfactors

.. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg
             :target: https://github.com/SunPower/pvfactors/blob/master/LICENSE

.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pvfactors.svg
                 :target: https://pypi.org/project/pvfactors

.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pvfactors.svg?logo=python&logoColor=white
                   :target: https://pypi.org/project/pvfactors



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SunPower/pvfactors",
    "name": "pvfactors",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "marc.abouanoma@sunpowercorp.com",
    "keywords": "",
    "author": "SunPower",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5d/fa/48cd1ae6b9ea390978e5dd2ef0e459de0a76342ea29f45fb28b4dd32e990/pvfactors-1.5.2.tar.gz",
    "platform": "",
    "description": "pvfactors: irradiance modeling made simple\n==========================================\n\n|Logo|\n\n|CircleCI|  |License|  |PyPI-Status|  |PyPI-Versions|\n\npvfactors is a tool used by PV professionals to calculate the\nirradiance incident on surfaces of a photovoltaic array. It relies on the use of\n2D geometries and view factors integrated mathematically into systems of\nequations to account for reflections between all of the surfaces.\n\npvfactors was originally ported from the SunPower developed 'vf_model' package, which was introduced at the IEEE PV Specialist Conference 44 2017 (see [#pvfactors_paper]_ and link_ to paper).\n\n------------------------------------------\n\n.. contents:: Table of contents\n   :backlinks: top\n   :local:\n\n\nDocumentation\n-------------\n\nThe documentation can be found `here <https://sunpower.github.io/pvfactors>`_.\nIt includes a lot of tutorials_ that describe the different ways of using pvfactors.\n\n\nQuick Start\n-----------\n\nGiven some timeseries inputs:\n\n\n.. code:: python\n\n   # Import external libraries\n   from datetime import datetime\n   import pandas as pd\n\n   # Create input data\n   df_inputs = pd.DataFrame(\n       {'solar_zenith': [20., 50.],\n        'solar_azimuth': [110., 250.],\n        'surface_tilt': [10., 20.],\n        'surface_azimuth': [90., 270.],\n        'dni': [1000., 900.],\n        'dhi': [50., 100.],\n        'albedo': [0.2, 0.2]},\n       index=[datetime(2017, 8, 31, 11), datetime(2017, 8, 31, 15)])\n   df_inputs\n\n\n+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+\n|                     | solar_zenith | solar_azimuth | surface_tilt | surface_azimuth | dni    | dhi   | albedo |\n+=====================+==============+===============+==============+=================+========+=======+========+\n| 2017-08-31 11:00:00 | 20.0         | 110.0         | 10.0         | 90.0            | 1000.0 | 50.0  | 0.2    |\n+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+\n| 2017-08-31 15:00:00 | 50.0         | 250.0         | 20.0         | 270.0           | 900.0  | 100.0 | 0.2    |\n+---------------------+--------------+---------------+--------------+-----------------+--------+-------+--------+\n\n\nAnd some PV array parameters\n\n\n.. code:: python\n\n   pvarray_parameters = {\n       'n_pvrows': 3,            # number of pv rows\n       'pvrow_height': 1,        # height of pvrows (measured at center / torque tube)\n       'pvrow_width': 1,         # width of pvrows\n       'axis_azimuth': 0.,       # azimuth angle of rotation axis\n       'gcr': 0.4,               # ground coverage ratio\n   }\n\nThe user can quickly create a PV array with ``pvfactors``, and manipulate it with the engine\n\n\n.. code:: python\n\n   from pvfactors.geometry import OrderedPVArray\n   # Create PV array\n   pvarray = OrderedPVArray.init_from_dict(pvarray_parameters)\n\n\n\n.. code:: python\n\n   from pvfactors.engine import PVEngine\n   # Create engine\n   engine = PVEngine(pvarray)\n   # Fit engine to data\n   engine.fit(df_inputs.index, df_inputs.dni, df_inputs.dhi,\n              df_inputs.solar_zenith, df_inputs.solar_azimuth,\n              df_inputs.surface_tilt, df_inputs.surface_azimuth,\n              df_inputs.albedo)\n\nThe user can then plot the PV array geometry at any given time of the simulation:\n\n\n.. code:: python\n\n   # Plot pvarray shapely geometries\n   f, ax = plt.subplots(figsize=(10, 5))\n   pvarray.plot_at_idx(1, ax)\n   plt.show()\n\n.. image:: https://raw.githubusercontent.com/SunPower/pvfactors/master/docs/sphinx/_static/pvarray.png\n\n\nIt is then very easy to run simulations using the defined engine:\n\n\n.. code:: python\n\n    pvarray = engine.run_full_mode(fn_build_report=lambda pvarray: pvarray)\n\n\nAnd inspect the results thanks to the simple geometry API\n\n\n.. code:: python\n\n    print(\"Incident irradiance on front surface of middle pv row: {} W/m2\"\n          .format(pvarray.ts_pvrows[1].front.get_param_weighted('qinc')))\n    print(\"Reflected irradiance on back surface of left pv row: {} W/m2\"\n          .format(pvarray.ts_pvrows[0].back.get_param_weighted('reflection')))\n    print(\"Isotropic irradiance on back surface of right pv row: {} W/m2\"\n          .format(pvarray.ts_pvrows[2].back.get_param_weighted('isotropic')))\n\n\n.. parsed-literal::\n\n    Incident irradiance on front surface of middle pv row: [1034.968  886.377] W/m2\n    Reflected irradiance on back surface of left pv row: [112.139  86.404] W/m2\n    Isotropic irradiance on back surface of right pv row: [0.116 1.849] W/m2\n\n\nThe users can also create a \"report\" while running the simulations that will rely on the simple API shown above, and which will look like whatever the users want.\n\n.. code:: python\n\n    # Create a function that will build a report\n    def fn_report(pvarray): return {'total_incident_back': pvarray.ts_pvrows[1].back.get_param_weighted('qinc'),\n                                    'total_absorbed_back': pvarray.ts_pvrows[1].back.get_param_weighted('qabs')}\n\n    # Run full mode simulation\n    report = engine.run_full_mode(fn_build_report=fn_report)\n\n    # Print results (report is defined by report function passed by user)\n    df_report = pd.DataFrame(report, index=df_inputs.index)\n    df_report\n\n\n+---------------------+---------------------+---------------------+\n|                     | total_incident_back | total_absorbed_back |\n+=====================+=====================+=====================+\n| 2017-08-31 11:00:00 |          106.627832 |          103.428997 |\n+---------------------+---------------------+---------------------+\n| 2017-08-31 15:00:00 |          79.668878  |           77.278812 |\n+---------------------+---------------------+---------------------+\n\n\n\nInstallation\n------------\n\npvfactors is currently compatible and tested with 3.6+, and is available in `PyPI <https://pypi.org/project/pvfactors/>`_. The easiest way to install pvfactors is to use pip_ as follows:\n\n.. code:: sh\n\n    $ pip install pvfactors\n\nThe package wheel files are also available in the `release section`_ of the Github repository.\n\n\nRequirements\n------------\n\nRequirements are included in the ``requirements.txt`` file of the package. Here is a list of important dependencies:\n\n* `numpy <https://pypi.python.org/pypi/numpy>`_\n* `pvlib-python <https://pypi.python.org/pypi/pvlib>`_\n* `shapely <https://pypi.python.org/pypi/Shapely>`_\n\n\nCiting pvfactors\n----------------\n\nWe appreciate your use of pvfactors. If you use pvfactors in a published work, we kindly ask that you cite:\n\n\n.. parsed-literal::\n\n   Anoma, M., Jacob, D., Bourne, B.C., Scholl, J.A., Riley, D.M. and Hansen, C.W., 2017. View Factor Model and Validation for Bifacial PV and Diffuse Shade on Single-Axis Trackers. In 44th IEEE Photovoltaic Specialist Conference.\n\n\nContributing\n------------\n\nContributions are needed in order to improve pvfactors.\nIf you wish to contribute, you can start by forking and cloning the repository, and then installing pvfactors using pip_ in the root folder of the package:\n\n.. code:: sh\n\n    $ pip install .\n\n\nTo install the package in editable mode, you can use:\n\n.. code:: sh\n\n    $ pip install -e .\n\nReleasing\n+++++++++\n\nWhen releasing pvfactors, you will need to run a couple of build commands. First make sure to activate your virtual environment if any, then:\n\n- create a tag on the latest master branch commit using `git tag -a vX.X.X`, and write a tag message. You can then push that tag to Github so that it will appear there.\n- build the documentation by running `make build-docs`. When done running, you should be able to open `build/sphinx/html/index.html`, and confirm that the version displayed is the same as the one from the git tag. You can deploy by copying the content of of the `build/sphinx/html/` folder into the `gh-pages` branch of the repo (make sure to keep the `.nojekyll` file that's already present).\n- build the release files by running `make build-package`. When done running, you should be able to open `dist/` and see both a whl file and and tar file. Make sure that their names include the correct git tag you created. Please confirm that the whl file was built correctly by installing it locally and testing the newly released updates. You can deploy by 1) making a Github release from the tag you created and pushed, and including the files in `dist/` in the release. 2) The last step is to publish a release in PyPI, for which you can use twine and the command `twine upload dist/*`\n\n\n\n\nReferences\n----------\n\n.. [#pvfactors_paper] Anoma, M., Jacob, D., Bourne, B. C., Scholl, J. A., Riley, D. M., & Hansen, C. W. (2017). View Factor Model and Validation for Bifacial PV and Diffuse Shade on Single-Axis Trackers. In 44th IEEE Photovoltaic Specialist Conference.\n\n\n.. _link: https://pdfs.semanticscholar.org/ebb2/35e3c3796b158e1a3c45b40954e60d876ea9.pdf\n\n.. _tutorials: https://sunpower.github.io/pvfactors/tutorials/index.html\n\n.. _`full mode`: https://sunpower.github.io/pvfactors/theory/problem_formulation.html#full-simulations\n\n.. _`fast mode`: https://sunpower.github.io/pvfactors/theory/problem_formulation.html#fast-simulations\n\n.. _pip: https://pip.pypa.io/en/stable/\n\n.. _`release section`: https://github.com/SunPower/pvfactors/releases\n\n.. |Logo| image:: https://raw.githubusercontent.com/SunPower/pvfactors/master/docs/sphinx/_static/logo.png\n          :target: http://sunpower.github.io/pvfactors/\n\n.. |CircleCI| image:: https://circleci.com/gh/SunPower/pvfactors.svg?style=shield\n              :target: https://circleci.com/gh/SunPower/pvfactors\n\n.. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg\n             :target: https://github.com/SunPower/pvfactors/blob/master/LICENSE\n\n.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pvfactors.svg\n                 :target: https://pypi.org/project/pvfactors\n\n.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pvfactors.svg?logo=python&logoColor=white\n                   :target: https://pypi.org/project/pvfactors\n\n\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "2D View Factor Model to calculate the irradiance incident on various surfaces of PV arrays",
    "version": "1.5.2",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4f68e917b696296e32d7b1b0fddaa83d98ef323cbcba7eb83e6ba60d507ddab",
                "md5": "e754b85702f11c7cd99f0716c92b5fd1",
                "sha256": "db44c5623977dda2eb2bde30613bd0b36882b5da1737bb99206b1969758c449c"
            },
            "downloads": -1,
            "filename": "pvfactors-1.5.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e754b85702f11c7cd99f0716c92b5fd1",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 72992,
            "upload_time": "2022-02-24T19:41:33",
            "upload_time_iso_8601": "2022-02-24T19:41:33.346370Z",
            "url": "https://files.pythonhosted.org/packages/a4/f6/8e917b696296e32d7b1b0fddaa83d98ef323cbcba7eb83e6ba60d507ddab/pvfactors-1.5.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5dfa48cd1ae6b9ea390978e5dd2ef0e459de0a76342ea29f45fb28b4dd32e990",
                "md5": "b3876c905583be87af974d5a2f3c7d1e",
                "sha256": "bbca3d05a919581e2f5c58f6aaa1b9803d4816ad3b858229a44c3c13c6daa35a"
            },
            "downloads": -1,
            "filename": "pvfactors-1.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b3876c905583be87af974d5a2f3c7d1e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 82529,
            "upload_time": "2022-02-24T19:41:35",
            "upload_time_iso_8601": "2022-02-24T19:41:35.206344Z",
            "url": "https://files.pythonhosted.org/packages/5d/fa/48cd1ae6b9ea390978e5dd2ef0e459de0a76342ea29f45fb28b4dd32e990/pvfactors-1.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-02-24 19:41:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "SunPower",
    "github_project": "pvfactors",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [],
    "lcname": "pvfactors"
}
        
Elapsed time: 0.04315s