Skip to content

Commit 5b05914

Browse files
Add benchmarks for infinite sheds (#1627)
* slight changes to min asv config * infite sheds benchmark * get_irradiance benchmarks * whatsnew * Update docs/sphinx/source/whatsnew/v0.9.5.rst Co-authored-by: Kevin Anderson <[email protected]> * one day * cleanup Co-authored-by: Kevin Anderson <[email protected]>
1 parent 57625c3 commit 5b05914

File tree

4 files changed

+110
-5
lines changed

4 files changed

+110
-5
lines changed

benchmarks/asv.conf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@
115115
{
116116
"python": "3.7",
117117
"build": "",
118-
"numpy": "1.16.0",
118+
"numpy": "1.16.5",
119119
"pandas": "0.25.0",
120120
"scipy": "1.4.0",
121121
// Note: these don't have a minimum in setup.py
122-
"h5py": "2.10.0",
122+
"h5py": "3.1.0",
123123
"ephem": "3.7.6.0",
124-
"numba": "0.40.0",
124+
"numba": "0.40.0"
125125
},
126126
// latest versions available
127127
{
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
"""
2+
ASV benchmarks for infinite_sheds.py
3+
"""
4+
5+
import numpy as np
6+
import pandas as pd
7+
from pvlib.bifacial import infinite_sheds
8+
from pvlib import location, tracking
9+
10+
11+
class InfiniteSheds:
12+
13+
def setup(self):
14+
self.times = pd.date_range(start='20180601', freq='1min',
15+
periods=1440)
16+
self.location = location.Location(40, -80)
17+
self.solar_position = self.location.get_solarposition(self.times)
18+
self.clearsky_irradiance = self.location.get_clearsky(
19+
self.times,
20+
solar_position=self.solar_position,
21+
)
22+
self.surface_tilt = 20
23+
self.surface_azimuth = 180
24+
self.gcr = 0.35
25+
self.height = 2.5
26+
self.pitch = 5.
27+
self.albedo = 0.2
28+
self.npoints = 100
29+
30+
with np.errstate(invalid='ignore'):
31+
self.tracking = tracking.singleaxis(
32+
self.solar_position['apparent_zenith'],
33+
self.solar_position['azimuth'],
34+
axis_tilt=0,
35+
axis_azimuth=0,
36+
max_angle=60,
37+
backtrack=True,
38+
gcr=self.gcr
39+
)
40+
41+
def time_get_irradiance_poa_fixed(self):
42+
infinite_sheds.get_irradiance_poa(
43+
surface_tilt=self.surface_tilt,
44+
surface_azimuth=self.surface_azimuth,
45+
solar_zenith=self.solar_position['apparent_zenith'],
46+
solar_azimuth=self.solar_position['azimuth'],
47+
gcr=self.gcr,
48+
height=self.height,
49+
pitch=self.pitch,
50+
ghi=self.clearsky_irradiance['ghi'],
51+
dhi=self.clearsky_irradiance['dhi'],
52+
dni=self.clearsky_irradiance['dni'],
53+
albedo=self.albedo,
54+
npoints=self.npoints
55+
)
56+
57+
def time_get_irradiance_poa_tracking(self):
58+
infinite_sheds.get_irradiance_poa(
59+
surface_tilt=self.tracking['surface_tilt'],
60+
surface_azimuth=self.tracking['surface_azimuth'],
61+
solar_zenith=self.solar_position['apparent_zenith'],
62+
solar_azimuth=self.solar_position['azimuth'],
63+
gcr=self.gcr,
64+
height=self.height,
65+
pitch=self.pitch,
66+
ghi=self.clearsky_irradiance['ghi'],
67+
dhi=self.clearsky_irradiance['dhi'],
68+
dni=self.clearsky_irradiance['dni'],
69+
albedo=self.albedo,
70+
npoints=self.npoints
71+
)
72+
73+
def time_get_irradiance_fixed(self):
74+
infinite_sheds.get_irradiance(
75+
surface_tilt=self.surface_tilt,
76+
surface_azimuth=self.surface_azimuth,
77+
solar_zenith=self.solar_position['apparent_zenith'],
78+
solar_azimuth=self.solar_position['azimuth'],
79+
gcr=self.gcr,
80+
height=self.height,
81+
pitch=self.pitch,
82+
ghi=self.clearsky_irradiance['ghi'],
83+
dhi=self.clearsky_irradiance['dhi'],
84+
dni=self.clearsky_irradiance['dni'],
85+
albedo=self.albedo,
86+
npoints=self.npoints
87+
)
88+
89+
def time_get_irradiance_tracking(self):
90+
infinite_sheds.get_irradiance(
91+
surface_tilt=self.tracking['surface_tilt'],
92+
surface_azimuth=self.tracking['surface_azimuth'],
93+
solar_zenith=self.solar_position['apparent_zenith'],
94+
solar_azimuth=self.solar_position['azimuth'],
95+
gcr=self.gcr,
96+
height=self.height,
97+
pitch=self.pitch,
98+
ghi=self.clearsky_irradiance['ghi'],
99+
dhi=self.clearsky_irradiance['dhi'],
100+
dni=self.clearsky_irradiance['dni'],
101+
albedo=self.albedo,
102+
npoints=self.npoints
103+
)

docs/sphinx/source/whatsnew.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ What's New
66

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

9+
.. include:: whatsnew/v0.9.5.rst
910
.. include:: whatsnew/v0.9.4.rst
1011
.. include:: whatsnew/v0.9.3.rst
1112
.. include:: whatsnew/v0.9.2.rst

docs/sphinx/source/whatsnew/v0.9.5.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ Documentation
3232

3333
Benchmarking
3434
~~~~~~~~~~~~~
35-
35+
* Added benchmarks for :py:mod:`pvlib.bifacial.infinite_sheds` (:pull:`1627`)
3636

3737
Requirements
3838
~~~~~~~~~~~~
3939

4040

4141
Contributors
4242
~~~~~~~~~~~~
43-
43+
* Kevin Anderson (:ghuser:`kanderso-nrel`)
44+
* Will Holmgren (:ghuser:`wholmgren`)

0 commit comments

Comments
 (0)