Skip to content

Add benchmarks for infinite sheds #1627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@
{
"python": "3.7",
"build": "",
"numpy": "1.16.0",
"numpy": "1.16.5",
"pandas": "0.25.0",
"scipy": "1.4.0",
// Note: these don't have a minimum in setup.py
"h5py": "2.10.0",
"h5py": "3.1.0",
"ephem": "3.7.6.0",
"numba": "0.40.0",
"numba": "0.40.0"
},
// latest versions available
{
Expand Down
103 changes: 103 additions & 0 deletions benchmarks/benchmarks/infinite_sheds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
"""
ASV benchmarks for infinite_sheds.py
"""

import numpy as np
import pandas as pd
from pvlib.bifacial import infinite_sheds
from pvlib import location, tracking


class InfiniteSheds:

def setup(self):
self.times = pd.date_range(start='20180601', freq='1min',
periods=1440)
self.location = location.Location(40, -80)
self.solar_position = self.location.get_solarposition(self.times)
self.clearsky_irradiance = self.location.get_clearsky(
self.times,
solar_position=self.solar_position,
)
self.surface_tilt = 20
self.surface_azimuth = 180
self.gcr = 0.35
self.height = 2.5
self.pitch = 5.
self.albedo = 0.2
self.npoints = 100

with np.errstate(invalid='ignore'):
self.tracking = tracking.singleaxis(
self.solar_position['apparent_zenith'],
self.solar_position['azimuth'],
axis_tilt=0,
axis_azimuth=0,
max_angle=60,
backtrack=True,
gcr=self.gcr
)

def time_get_irradiance_poa_fixed(self):
infinite_sheds.get_irradiance_poa(
surface_tilt=self.surface_tilt,
surface_azimuth=self.surface_azimuth,
solar_zenith=self.solar_position['apparent_zenith'],
solar_azimuth=self.solar_position['azimuth'],
gcr=self.gcr,
height=self.height,
pitch=self.pitch,
ghi=self.clearsky_irradiance['ghi'],
dhi=self.clearsky_irradiance['dhi'],
dni=self.clearsky_irradiance['dni'],
albedo=self.albedo,
npoints=self.npoints
)

def time_get_irradiance_poa_tracking(self):
infinite_sheds.get_irradiance_poa(
surface_tilt=self.tracking['surface_tilt'],
surface_azimuth=self.tracking['surface_azimuth'],
solar_zenith=self.solar_position['apparent_zenith'],
solar_azimuth=self.solar_position['azimuth'],
gcr=self.gcr,
height=self.height,
pitch=self.pitch,
ghi=self.clearsky_irradiance['ghi'],
dhi=self.clearsky_irradiance['dhi'],
dni=self.clearsky_irradiance['dni'],
albedo=self.albedo,
npoints=self.npoints
)

def time_get_irradiance_fixed(self):
infinite_sheds.get_irradiance(
surface_tilt=self.surface_tilt,
surface_azimuth=self.surface_azimuth,
solar_zenith=self.solar_position['apparent_zenith'],
solar_azimuth=self.solar_position['azimuth'],
gcr=self.gcr,
height=self.height,
pitch=self.pitch,
ghi=self.clearsky_irradiance['ghi'],
dhi=self.clearsky_irradiance['dhi'],
dni=self.clearsky_irradiance['dni'],
albedo=self.albedo,
npoints=self.npoints
)

def time_get_irradiance_tracking(self):
infinite_sheds.get_irradiance(
surface_tilt=self.tracking['surface_tilt'],
surface_azimuth=self.tracking['surface_azimuth'],
solar_zenith=self.solar_position['apparent_zenith'],
solar_azimuth=self.solar_position['azimuth'],
gcr=self.gcr,
height=self.height,
pitch=self.pitch,
ghi=self.clearsky_irradiance['ghi'],
dhi=self.clearsky_irradiance['dhi'],
dni=self.clearsky_irradiance['dni'],
albedo=self.albedo,
npoints=self.npoints
)
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ What's New

These are new features and improvements of note in each release.

.. include:: whatsnew/v0.9.5.rst
.. include:: whatsnew/v0.9.4.rst
.. include:: whatsnew/v0.9.3.rst
.. include:: whatsnew/v0.9.2.rst
Expand Down
5 changes: 3 additions & 2 deletions docs/sphinx/source/whatsnew/v0.9.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ Documentation

Benchmarking
~~~~~~~~~~~~~

* Added benchmarks for :py:mod:`pvlib.bifacial.infinite_sheds` (:pull:`1627`)

Requirements
~~~~~~~~~~~~


Contributors
~~~~~~~~~~~~

* Kevin Anderson (:ghuser:`kanderso-nrel`)
* Will Holmgren (:ghuser:`wholmgren`)