PVLIB API

Software for simulating photovoltaic solar energy systems.

This is a tutorial and API to the pvlib python library.

PV Modeling Steps

Weather

The first step in evaluating PV system performance is to get the weather at the site.


Browse for TMY2 or TMY3 file.


Click on the map and enter the dates for years, desired frequency, source to pull weather from, and check if you want TMY data only. If you select TMY2 or TMY3, upload the file instead. Summary data is shown below:


Solar Position

The next step in modeling a PV system is to get the solar positions for a specific time range at the site. Solar position is a vector from the site to the sun given by its zenith and azimuth. The zenith is the sun's angle from directly overhead, and the azimuth is the angle from true north. Use the PVLIB API by sending a GET request to /api/v1/pvlib/solarposition/, the response is JSON with the solar zenith and azimuth at each time specified. The API calls pvlib.solarposition.get_solarposition The calculation requires the following parameters:

Note: the API uses pandas to parse dates and times, see the documentation for formats.

Example

Try the following: /api/v1/pvlib/solarposition/?lat=38&lon=-122&start=2018-01-01 7:00&end=2018-01-01 8:00&freq=T&tz=-8



Ernter the dates and frequency fields above or click to copy from weather, then click submit to see what your request looks like, a plot of azimuth vs. zenith, and a table of solar positions below:

Linke Turbidity

If you want to calculate clear sky irradiance you may need Linke Turbidity or AOD and precipitable water.

Example

Try the following: /api/v1/pvlib/linke-turbidity/?tl_lat=38&tl_lon=-122&tl_start=2018-01-01 7:00&tl_end=2018-01-01 8:00&tl_freq=T&tl_tz=-8



Enter the fields above and then click submit to see what your request looks like and a table of Linke Turbidity values below:

Air Mass

Air mass is a measure of the path length through the atmosphere measured in atmospheres. On the equator at solar noon on the equinox, when the sun is directly overhead, the air mass is 1 atmospere. The reference atmosphere, ASTM G173-03, has an air mass of 1.5 atmospheres, and is usually called AM1.5. It's equivalent to a spring noon in the southwest USA.

Example

You'll need to send a POST request with solar position data. Try this curl -H "Content-Type: application/json" -X POST /api/v1/pvlib/airmass/ -d '{"model":"kastenyoung1989","zenith_data":{"2019-01-01T09:00:00-0800":{"apparent_zenith":"75.64949399351546"},"2019-01-01T12:00:00-0800":{"apparent_zenith":"60.93578142843924"}}}'.



Enter the fields above and then click submit to see what your request looks like and a table of air mass data. values below: