2D View Factor Model to calculate the irradiance incident on various surfaces of PV arrays

# pvfactors (open-source fork of vf_model) pvfactors is a tool designed for 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 a linear system of equations.

This package is the open-source fork of the original 'vf_model' package developed by SunPower, and which had over 300 commits. The package was used for all the material presented at IEEE PVSC 44 2017 (see  and link to paper).

## Documentation

The documentation can be found here. Please refer to the TL;DR section below to find a quick start tutorial.

## Installation

pvfactors is currently compatible and tested with Python versions 2.7 and 3.6, and is available in PyPI.

The easiest way to install pvfactors is to use pip as follows:

``````\$ pip install pvfactors
``````

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

## Requirements

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

## Notebook demo

The following Jupyter notebook is a good way to get a quick overview: notebook

## TL;DR - Quick Start

Given some timeseries inputs:

```import numpy as np
from datetime import datetime
timestamps = np.array([datetime(2017, 8, 31, 11), datetime(2017, 8, 31, 12)])
solar_zenith = np.array([20., 10.])
solar_azimuth = np.array([110., 140.])
surface_tilt = np.array([10., 0.])
surface_azimuth = np.array([90., 90.])
dni = np.array([1000., 300.])
dhi = np.array([50., 500.])
```

And some PV array parameters:

```pvarray_parameters = {
'n_pvrows': 3,         # number of pv rows
'pvrow_height': 1.75,  # height of pvrows (measured at center / torque tube)
'pvrow_width': 2.44,   # width of pvrows
'gcr': 0.4,            # ground coverage ratio
'rho_ground': 0.2,     # albedo
}
```

The user can quickly run a timeseries simulation using `pvfactors` as shown below:

```from pvfactors.timeseries import calculate_radiosities_serially_perez

pvarray_parameters, timestamps,
solar_zenith, solar_azimuth,
surface_tilt, surface_azimuth, dni, dhi))
```
``````Progress: |██████████████████████████████████████████████████| 100.0% Complete
``````

If the raw outputs are too detailed for the user, they can be formatted quickly thanks to helper functions:

```from pvfactors.timeseries import get_average_pvrow_outputs

df_avg_outputs = get_average_pvrow_outputs(df_registries,
values=['qinc', 'isotropic_term', 'reflection_term', 'horizon_term'])
df_avg_outputs
```
pvrow_index 0 ... 2
surface_side back front ... back front
timestamps
2017-08-31 11:00:00 1.221181 0.117972 93.339589 92.000435 False 1.640681 20.982303 1035.231572 1.217963e+00 False ... 1.640681 0.199001 97.261729 95.422048 False 1.640681 20.849825 1034.889434 1.008302e+00 False
2017-08-31 12:00:00 0.000000 0.863797 83.197488 82.333691 False 0.000000 206.332401 795.442326 -5.684342e-14 False ... 0.000000 382.033336 170.382030 -211.651306 False 0.000000 206.332401 795.442326 -5.684342e-14 False

2 rows × 30 columns

The user can also plot the pv array at a given time of the simulation:

```from pvfactors.plot import plot_array_from_registry

f, ax = plt.subplots(figsize=(10, 4))
plot_array_from_registry(ax, df_registries.set_index('timestamps').loc["2017-8-31 11:00:00", :])
ax.set_xlim(-2, 15)
plt.show()
``` ## Contributing

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

``````\$ pip install .
``````

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

``````\$ pip install -e .
``````

## References

 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.

## Project details 1.4.1 1.4.0 1.3.0 1.2.2 1.2.1 1.2.0 1.1.0 1.0.3 1.0.2 1.0.1 1.0.0 0.1.5

This version 0.1.5a1 pre-release 0.1.5a0 pre-release 0.1.4 0.1.3