pvlib 0.9.4a1__py3-none-any.whl → 0.10.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. pvlib/__init__.py +3 -2
  2. pvlib/atmosphere.py +23 -173
  3. pvlib/bifacial/infinite_sheds.py +88 -277
  4. pvlib/bifacial/utils.py +270 -28
  5. pvlib/data/adr-library-cec-inverters-2019-03-05.csv +5009 -0
  6. pvlib/data/precise_iv_curves1.json +10251 -0
  7. pvlib/data/precise_iv_curves2.json +10251 -0
  8. pvlib/data/precise_iv_curves_parameter_sets1.csv +33 -0
  9. pvlib/data/precise_iv_curves_parameter_sets2.csv +33 -0
  10. pvlib/data/test_psm3_2017.csv +17521 -17521
  11. pvlib/data/test_psm3_2019_5min.csv +288 -288
  12. pvlib/data/test_read_psm3.csv +17522 -17522
  13. pvlib/data/test_read_pvgis_horizon.csv +49 -0
  14. pvlib/data/variables_style_rules.csv +3 -0
  15. pvlib/iam.py +207 -51
  16. pvlib/inverter.py +6 -1
  17. pvlib/iotools/__init__.py +7 -2
  18. pvlib/iotools/acis.py +516 -0
  19. pvlib/iotools/midc.py +4 -4
  20. pvlib/iotools/psm3.py +59 -42
  21. pvlib/iotools/pvgis.py +84 -28
  22. pvlib/iotools/sodapro.py +8 -6
  23. pvlib/iotools/srml.py +121 -18
  24. pvlib/iotools/surfrad.py +2 -2
  25. pvlib/iotools/tmy.py +146 -102
  26. pvlib/irradiance.py +270 -15
  27. pvlib/ivtools/sde.py +14 -20
  28. pvlib/ivtools/sdm.py +31 -20
  29. pvlib/ivtools/utils.py +127 -6
  30. pvlib/location.py +3 -2
  31. pvlib/modelchain.py +67 -70
  32. pvlib/pvarray.py +225 -0
  33. pvlib/pvsystem.py +169 -539
  34. pvlib/shading.py +43 -2
  35. pvlib/singlediode.py +216 -66
  36. pvlib/snow.py +36 -15
  37. pvlib/soiling.py +3 -3
  38. pvlib/spa.py +327 -368
  39. pvlib/spectrum/__init__.py +8 -2
  40. pvlib/spectrum/mismatch.py +335 -0
  41. pvlib/temperature.py +124 -13
  42. pvlib/tests/bifacial/test_infinite_sheds.py +44 -106
  43. pvlib/tests/bifacial/test_utils.py +102 -5
  44. pvlib/tests/conftest.py +0 -31
  45. pvlib/tests/iotools/test_acis.py +213 -0
  46. pvlib/tests/iotools/test_midc.py +6 -6
  47. pvlib/tests/iotools/test_psm3.py +7 -5
  48. pvlib/tests/iotools/test_pvgis.py +21 -14
  49. pvlib/tests/iotools/test_sodapro.py +1 -1
  50. pvlib/tests/iotools/test_srml.py +71 -6
  51. pvlib/tests/iotools/test_tmy.py +43 -8
  52. pvlib/tests/ivtools/test_sde.py +19 -17
  53. pvlib/tests/ivtools/test_sdm.py +9 -4
  54. pvlib/tests/ivtools/test_utils.py +96 -1
  55. pvlib/tests/test_atmosphere.py +8 -64
  56. pvlib/tests/test_clearsky.py +0 -1
  57. pvlib/tests/test_iam.py +74 -1
  58. pvlib/tests/test_irradiance.py +56 -2
  59. pvlib/tests/test_location.py +1 -1
  60. pvlib/tests/test_modelchain.py +33 -76
  61. pvlib/tests/test_pvarray.py +46 -0
  62. pvlib/tests/test_pvsystem.py +366 -201
  63. pvlib/tests/test_shading.py +35 -0
  64. pvlib/tests/test_singlediode.py +306 -29
  65. pvlib/tests/test_snow.py +84 -1
  66. pvlib/tests/test_soiling.py +8 -7
  67. pvlib/tests/test_solarposition.py +7 -7
  68. pvlib/tests/test_spa.py +6 -7
  69. pvlib/tests/test_spectrum.py +145 -1
  70. pvlib/tests/test_temperature.py +29 -11
  71. pvlib/tests/test_tools.py +41 -0
  72. pvlib/tests/test_tracking.py +0 -149
  73. pvlib/tools.py +49 -25
  74. pvlib/tracking.py +1 -269
  75. pvlib-0.10.0.dist-info/AUTHORS.md +35 -0
  76. {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/LICENSE +5 -2
  77. {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/METADATA +3 -13
  78. {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/RECORD +80 -75
  79. {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/WHEEL +1 -1
  80. pvlib/data/adr-library-2013-10-01.csv +0 -1762
  81. pvlib/forecast.py +0 -1211
  82. pvlib/iotools/ecmwf_macc.py +0 -312
  83. pvlib/tests/iotools/test_ecmwf_macc.py +0 -162
  84. pvlib/tests/test_forecast.py +0 -228
  85. pvlib-0.9.4a1.dist-info/AUTHORS.md +0 -32
  86. {pvlib-0.9.4a1.dist-info → pvlib-0.10.0.dist-info}/top_level.txt +0 -0
@@ -6,64 +6,7 @@ import numpy as np
6
6
  import pandas as pd
7
7
  from pvlib.tools import cosd, sind, tand
8
8
  from pvlib.bifacial import utils
9
- from pvlib.shading import masking_angle
10
- from pvlib.irradiance import beam_component, aoi
11
-
12
-
13
- def _vf_ground_sky_integ(surface_tilt, surface_azimuth, gcr, height,
14
- pitch, max_rows=10, npoints=100):
15
- """
16
- Integrated and per-point view factors from the ground to the sky at points
17
- between interior rows of the array.
18
-
19
- Parameters
20
- ----------
21
- surface_tilt : numeric
22
- Surface tilt angle in degrees from horizontal, e.g., surface facing up
23
- = 0, surface facing horizon = 90. [degree]
24
- surface_azimuth : numeric
25
- Surface azimuth angles in decimal degrees east of north
26
- (e.g. North = 0, South = 180, East = 90, West = 270).
27
- ``surface_azimuth`` must be >=0 and <=360.
28
- gcr : float
29
- Ratio of row slant length to row spacing (pitch). [unitless]
30
- height : float
31
- Height of the center point of the row above the ground; must be in the
32
- same units as ``pitch``.
33
- pitch : float
34
- Distance between two rows. Must be in the same units as ``height``.
35
- max_rows : int, default 10
36
- Maximum number of rows to consider in front and behind the current row.
37
- npoints : int, default 100
38
- Number of points used to discretize distance along the ground.
39
-
40
- Returns
41
- -------
42
- fgnd_sky : float
43
- Integration of view factor over the length between adjacent, interior
44
- rows. [unitless]
45
- fz : ndarray
46
- Fraction of distance from the previous row to the next row. [unitless]
47
- fz_sky : ndarray
48
- View factors at discrete points between adjacent, interior rows.
49
- [unitless]
50
-
51
- """
52
- # TODO: vectorize over surface_tilt
53
- # Abuse utils._vf_ground_sky_2d by supplying surface_tilt in place
54
- # of a signed rotation. This is OK because
55
- # 1) z span the full distance between 2 rows, and
56
- # 2) max_rows is set to be large upstream, and
57
- # 3) _vf_ground_sky_2d considers [-max_rows, +max_rows]
58
- # The VFs to the sky will thus be symmetric around z=0.5
59
- z = np.linspace(0, 1, npoints)
60
- rotation = np.atleast_1d(surface_tilt)
61
- fz_sky = np.zeros((len(rotation), npoints))
62
- for k, r in enumerate(rotation):
63
- vf, _ = utils._vf_ground_sky_2d(z, r, gcr, pitch, height, max_rows)
64
- fz_sky[k, :] = vf
65
- # calculate the integrated view factor for all of the ground between rows
66
- return np.trapz(fz_sky, z, axis=1)
9
+ from pvlib.irradiance import beam_component, aoi, haydavies
67
10
 
68
11
 
69
12
  def _poa_ground_shadows(poa_ground, f_gnd_beam, df, vf_gnd_sky):
@@ -95,15 +38,16 @@ def _poa_ground_shadows(poa_ground, f_gnd_beam, df, vf_gnd_sky):
95
38
  return poa_ground * (f_gnd_beam*(1 - df) + df*vf_gnd_sky)
96
39
 
97
40
 
98
- def _vf_row_sky_integ(f_x, surface_tilt, gcr, npoints=100):
99
- """
41
+ def _poa_sky_diffuse_pv(dhi, gcr, surface_tilt):
42
+ r"""
100
43
  Integrated view factors from the shaded and unshaded parts of
101
44
  the row slant height to the sky.
102
45
 
103
46
  Parameters
104
47
  ----------
105
48
  f_x : numeric
106
- Fraction of row slant height from the bottom that is shaded. [unitless]
49
+ Fraction of row slant height from the bottom that is shaded from
50
+ direct irradiance. [unitless]
107
51
  surface_tilt : numeric
108
52
  Surface tilt angle in degrees from horizontal, e.g., surface facing up
109
53
  = 0, surface facing horizon = 90. [degree]
@@ -112,231 +56,67 @@ def _vf_row_sky_integ(f_x, surface_tilt, gcr, npoints=100):
112
56
  npoints : int, default 100
113
57
  Number of points for integration. [unitless]
114
58
 
115
- Returns
116
- -------
117
- vf_shade_sky_integ : numeric
118
- Integrated view factor from the shaded part of the row to the sky.
119
- [unitless]
120
- vf_noshade_sky_integ : numeric
121
- Integrated view factor from the unshaded part of the row to the sky.
122
- [unitless]
59
+ A detailed calculation would be
123
60
 
124
- Notes
125
- -----
126
- The view factor to the sky at a point x along the row slant height is
127
- given by
61
+ dhi * (f_x * vf_shade_sky_integ + (1 - f_x) * vf_noshade_sky_integ)
128
62
 
129
- .. math ::
130
- \\large{f_{sky} = \frac{1}{2} \\left(\\cos\\left(\\psi_t\\right) +
131
- \\cos \\left(\\beta\\right) \\right)
63
+ where vf_shade_sky_integ is the average view factor between 0 and f_x
64
+ (the shaded portion). But the average view factor is
132
65
 
133
- where :math:`\\psi_t` is the angle from horizontal of the line from point
134
- x to the top of the facing row, and :math:`\\beta` is the surface tilt.
66
+ 1/(f_x - 0) Integral_0^f_x vf(x) dx
135
67
 
136
- View factors are integrated separately over shaded and unshaded portions
137
- of the row slant height.
68
+ so the detailed calculation is equivalent to
138
69
 
139
- """
140
- # handle Series inputs
141
- surface_tilt = np.array(surface_tilt)
142
- cst = cosd(surface_tilt)
143
- # shaded portion
144
- x = np.linspace(0, f_x, num=npoints)
145
- psi_t_shaded = masking_angle(surface_tilt, gcr, x)
146
- y = 0.5 * (cosd(psi_t_shaded) + cst)
147
- # integrate view factors from each point in the discretization. This is an
148
- # improvement over the algorithm described in [2]
149
- vf_shade_sky_integ = np.trapz(y, x, axis=0)
150
- # unshaded portion
151
- x = np.linspace(f_x, 1., num=npoints)
152
- psi_t_unshaded = masking_angle(surface_tilt, gcr, x)
153
- y = 0.5 * (cosd(psi_t_unshaded) + cst)
154
- vf_noshade_sky_integ = np.trapz(y, x, axis=0)
155
- return vf_shade_sky_integ, vf_noshade_sky_integ
156
-
157
-
158
- def _poa_sky_diffuse_pv(f_x, dhi, vf_shade_sky_integ, vf_noshade_sky_integ):
159
- """
160
- Sky diffuse POA from integrated view factors combined for both shaded and
161
- unshaded parts of the surface.
70
+ dhi * 1/(1 - 0) Integral_0^1 vf(x) dx
162
71
 
163
72
  Parameters
164
73
  ----------
165
74
  f_x : numeric
166
- Fraction of row slant height from the bottom that is shaded. [unitless]
75
+ Fraction of row slant height from the bottom that is shaded from
76
+ direct irradiance. [unitless]
167
77
  dhi : numeric
168
78
  Diffuse horizontal irradiance (DHI). [W/m^2]
169
- vf_shade_sky_integ : numeric
170
- Integrated view factor from the shaded part of the row to the sky.
171
- [unitless]
172
- vf_noshade_sky_integ : numeric
173
- Integrated view factor from the unshaded part of the row to the sky.
174
- [unitless]
175
-
176
- Returns
177
- -------
178
- poa_sky_diffuse_pv : numeric
179
- Total sky diffuse irradiance incident on the PV surface. [W/m^2]
180
- """
181
- return dhi * (f_x * vf_shade_sky_integ + (1 - f_x) * vf_noshade_sky_integ)
182
-
183
-
184
- def _ground_angle(x, surface_tilt, gcr):
185
- """
186
- Angle from horizontal of the line from a point x on the row slant length
187
- to the bottom of the facing row.
188
-
189
- The angles are clockwise from horizontal, rather than the usual
190
- counterclockwise direction.
191
-
192
- Parameters
193
- ----------
194
- x : numeric
195
- fraction of row slant length from bottom, ``x = 0`` is at the row
196
- bottom, ``x = 1`` is at the top of the row.
197
- surface_tilt : numeric
198
- Surface tilt angle in degrees from horizontal, e.g., surface facing up
199
- = 0, surface facing horizon = 90. [degree]
200
79
  gcr : float
201
80
  ground coverage ratio, ratio of row slant length to row spacing.
202
81
  [unitless]
203
-
204
- Returns
205
- -------
206
- psi : numeric
207
- Angle [degree].
208
- """
209
- # : \\ \
210
- # : \\ \
211
- # : \\ \
212
- # : \\ \ facing row
213
- # : \\.___________\
214
- # : \ ^*-. psi \
215
- # : \ x *-. \
216
- # : \ v *-.\
217
- # : \<-----P---->\
218
-
219
- x1 = x * sind(surface_tilt)
220
- x2 = (x * cosd(surface_tilt) + 1 / gcr)
221
- psi = np.arctan2(x1, x2) # do this first because it handles 0 / 0
222
- return np.rad2deg(psi)
223
-
224
-
225
- def _vf_row_ground(x, surface_tilt, gcr):
226
- """
227
- View factor from a point x on the row to the ground.
228
-
229
- Parameters
230
- ----------
231
- x : numeric
232
- Fraction of row slant height from the bottom. [unitless]
233
82
  surface_tilt : numeric
234
83
  Surface tilt angle in degrees from horizontal, e.g., surface facing up
235
84
  = 0, surface facing horizon = 90. [degree]
236
- gcr : float
237
- Ground coverage ratio, ratio of row slant length to row spacing.
238
- [unitless]
239
85
 
240
86
  Returns
241
87
  -------
242
- vf : numeric
243
- View factor from the point at x to the ground. [unitless]
244
-
88
+ poa_sky_diffuse_pv : numeric
89
+ Total sky diffuse irradiance incident on the PV surface. [W/m^2]
245
90
  """
246
- cst = cosd(surface_tilt)
247
- # angle from horizontal at the point x on the row slant height to the
248
- # bottom of the facing row
249
- psi_t_shaded = _ground_angle(x, surface_tilt, gcr)
250
- # view factor from the point on the row to the ground
251
- return 0.5 * (cosd(psi_t_shaded) - cst)
91
+ vf_integ = utils.vf_row_sky_2d_integ(surface_tilt, gcr, 0., 1.)
92
+ return dhi * vf_integ
252
93
 
253
94
 
254
- def _vf_row_ground_integ(f_x, surface_tilt, gcr, npoints=100):
255
- """
256
- View factors to the ground from shaded and unshaded parts of a row.
257
-
258
- Parameters
259
- ----------
260
- f_x : numeric
261
- Fraction of row slant height from the bottom that is shaded. [unitless]
262
- surface_tilt : numeric
263
- Surface tilt angle in degrees from horizontal, e.g., surface facing up
264
- = 0, surface facing horizon = 90. [degree]
265
- gcr : float
266
- Ground coverage ratio, ratio of row slant length to row spacing.
267
- [unitless]
268
- npoints : int, default 100
269
- Number of points for integration. [unitless]
270
-
271
- Returns
272
- -------
273
- vf_shade_ground_integ : numeric
274
- View factor from the shaded portion of the row to the ground.
275
- [unitless]
276
- vf_noshade_ground_integ : numeric
277
- View factor from the unshaded portion of the row to the ground.
278
- [unitless]
279
-
280
- Notes
281
- -----
282
- The view factor to the ground at a point x along the row slant height is
283
- given by
284
-
285
- .. math ::
286
- \\large{f_{gr} = \frac{1}{2} \\left(\\cos\\left(\\psi_t\\right) -
287
- \\cos \\left(\\beta\\right) \\right)
288
-
289
- where :math:`\\psi_t` is the angle from horizontal of the line from point
290
- x to the bottom of the facing row, and :math:`\\beta` is the surface tilt.
291
-
292
- Each view factor is integrated over the relevant portion of the row
293
- slant height.
294
- """
295
- # handle Series inputs
296
- surface_tilt = np.array(surface_tilt)
297
- # shaded portion of row slant height
298
- x = np.linspace(0, f_x, num=npoints)
299
- # view factor from the point on the row to the ground
300
- y = _vf_row_ground(x, surface_tilt, gcr)
301
- # integrate view factors along the shaded portion of the row slant height.
302
- # This is an improvement over the algorithm described in [2]
303
- vf_shade_ground_integ = np.trapz(y, x, axis=0)
304
-
305
- # unshaded portion of row slant height
306
- x = np.linspace(f_x, 1., num=npoints)
307
- # view factor from the point on the row to the ground
308
- y = _vf_row_ground(x, surface_tilt, gcr)
309
- # integrate view factors along the unshaded portion.
310
- # This is an improvement over the algorithm described in [2]
311
- vf_noshade_ground_integ = np.trapz(y, x, axis=0)
312
-
313
- return vf_shade_ground_integ, vf_noshade_ground_integ
314
-
315
-
316
- def _poa_ground_pv(f_x, poa_ground, f_gnd_pv_shade, f_gnd_pv_noshade):
95
+ def _poa_ground_pv(poa_ground, gcr, surface_tilt):
317
96
  """
318
97
  Reduce ground-reflected irradiance to account for limited view of the
319
98
  ground from the row surface.
320
99
 
321
100
  Parameters
322
101
  ----------
323
- f_x : numeric
324
- Fraction of row slant height from the bottom that is shaded. [unitless]
325
102
  poa_ground : numeric
326
103
  Ground-reflected irradiance that would reach the row surface if the
327
104
  full ground was visible. poa_gnd_sky accounts for limited view of the
328
105
  sky from the ground. [W/m^2]
329
- f_gnd_pv_shade : numeric
330
- fraction of ground visible from shaded part of PV surface. [unitless]
331
- f_gnd_pv_noshade : numeric
332
- fraction of ground visible from unshaded part of PV surface. [unitless]
106
+ gcr : float
107
+ ground coverage ratio, ratio of row slant length to row spacing.
108
+ [unitless]
109
+ surface_tilt : numeric
110
+ Surface tilt angle in degrees from horizontal, e.g., surface facing up
111
+ = 0, surface facing horizon = 90. [degree]
333
112
 
334
113
  Returns
335
114
  -------
336
115
  numeric
337
116
  Ground diffuse irradiance on the row plane. [W/m^2]
338
117
  """
339
- return poa_ground * (f_x * f_gnd_pv_shade + (1 - f_x) * f_gnd_pv_noshade)
118
+ vf_integ = utils.vf_row_ground_2d_integ(surface_tilt, gcr, 0., 1.)
119
+ return poa_ground * vf_integ
340
120
 
341
121
 
342
122
  def _shaded_fraction(solar_zenith, solar_azimuth, surface_tilt,
@@ -401,7 +181,8 @@ def _shaded_fraction(solar_zenith, solar_azimuth, surface_tilt,
401
181
 
402
182
  def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
403
183
  solar_azimuth, gcr, height, pitch, ghi, dhi, dni,
404
- albedo, iam=1.0, npoints=100):
184
+ albedo, model='isotropic', dni_extra=None, iam=1.0,
185
+ npoints=100, vectorize=False):
405
186
  r"""
406
187
  Calculate plane-of-array (POA) irradiance on one side of a row of modules.
407
188
 
@@ -457,12 +238,24 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
457
238
  albedo : numeric
458
239
  Surface albedo. [unitless]
459
240
 
241
+ model : str, default 'isotropic'
242
+ Irradiance model - can be one of 'isotropic' or 'haydavies'.
243
+
244
+ dni_extra : numeric, optional
245
+ Extraterrestrial direct normal irradiance. Required when
246
+ ``model='haydavies'``. [W/m2]
247
+
460
248
  iam : numeric, default 1.0
461
249
  Incidence angle modifier, the fraction of direct irradiance incident
462
250
  on the surface that is not reflected away. [unitless]
463
251
 
464
252
  npoints : int, default 100
465
- Number of points used to discretize distance along the ground.
253
+ Number of discretization points for calculating integrated view
254
+ factors.
255
+
256
+ vectorize : bool, default False
257
+ If True, vectorize the view factor calculation across ``surface_tilt``.
258
+ This increases speed with the cost of increased memory usage.
466
259
 
467
260
  Returns
468
261
  -------
@@ -495,6 +288,27 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
495
288
  --------
496
289
  get_irradiance
497
290
  """
291
+ if model == 'haydavies':
292
+ if dni_extra is None:
293
+ raise ValueError(f'must supply dni_extra for {model} model')
294
+ # Call haydavies first time within the horizontal plane - to subtract
295
+ # circumsolar_horizontal from DHI
296
+ sky_diffuse_comps_horizontal = haydavies(0, 180, dhi, dni, dni_extra,
297
+ solar_zenith, solar_azimuth,
298
+ return_components=True)
299
+ circumsolar_horizontal = sky_diffuse_comps_horizontal['circumsolar']
300
+
301
+ # Call haydavies a second time where circumsolar_normal is facing
302
+ # directly towards sun, and can be added to DNI
303
+ sky_diffuse_comps_normal = haydavies(solar_zenith, solar_azimuth, dhi,
304
+ dni, dni_extra, solar_zenith,
305
+ solar_azimuth,
306
+ return_components=True)
307
+ circumsolar_normal = sky_diffuse_comps_normal['circumsolar']
308
+
309
+ dhi = dhi - circumsolar_horizontal
310
+ dni = dni + circumsolar_normal
311
+
498
312
  # Calculate some geometric quantities
499
313
  # rows to consider in front and behind current row
500
314
  # ensures that view factors to the sky are computed to within 5 degrees
@@ -508,31 +322,15 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
508
322
  # adjacent rows interior to the array
509
323
  # method differs from [1], Eq. 7 and Eq. 8; height is defined at row
510
324
  # center rather than at row lower edge as in [1].
511
- vf_gnd_sky = _vf_ground_sky_integ(
512
- surface_tilt, surface_azimuth, gcr, height, pitch, max_rows, npoints)
325
+ vf_gnd_sky = utils.vf_ground_sky_2d_integ(
326
+ surface_tilt, gcr, height, pitch, max_rows, npoints,
327
+ vectorize)
513
328
  # fraction of row slant height that is shaded from direct irradiance
514
329
  f_x = _shaded_fraction(solar_zenith, solar_azimuth, surface_tilt,
515
330
  surface_azimuth, gcr)
516
331
 
517
- # Integrated view factors to the sky from the shaded and unshaded parts of
518
- # the row slant height
519
- # Differs from [1] Eq. 15 and Eq. 16. Here, we integrate over each
520
- # interval (shaded or unshaded) rather than averaging values at each
521
- # interval's end points.
522
- vf_shade_sky, vf_noshade_sky = _vf_row_sky_integ(
523
- f_x, surface_tilt, gcr, npoints)
524
-
525
- # view factors from the ground to shaded and unshaded portions of the row
526
- # slant height
527
- # Differs from [1] Eq. 17 and Eq. 18. Here, we integrate over each
528
- # interval (shaded or unshaded) rather than averaging values at each
529
- # interval's end points.
530
- f_gnd_pv_shade, f_gnd_pv_noshade = _vf_row_ground_integ(
531
- f_x, surface_tilt, gcr, npoints)
532
-
533
332
  # Total sky diffuse received by both shaded and unshaded portions
534
- poa_sky_pv = _poa_sky_diffuse_pv(
535
- f_x, dhi, vf_shade_sky, vf_noshade_sky)
333
+ poa_sky_pv = _poa_sky_diffuse_pv(dhi, gcr, surface_tilt)
536
334
 
537
335
  # irradiance reflected from the ground before accounting for shadows
538
336
  # and restricted views
@@ -557,8 +355,7 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
557
355
  # the usual ground-reflected irradiance includes the single row to ground
558
356
  # view factor (1 - cos(tilt))/2, and Eq. 10, 11 and later multiply
559
357
  # this quantity by a ratio of view factors.
560
- poa_gnd_pv = _poa_ground_pv(
561
- f_x, ground_diffuse, f_gnd_pv_shade, f_gnd_pv_noshade)
358
+ poa_gnd_pv = _poa_ground_pv(ground_diffuse, gcr, surface_tilt)
562
359
 
563
360
  # add sky and ground-reflected irradiance on the row by irradiance
564
361
  # component
@@ -580,9 +377,9 @@ def get_irradiance_poa(surface_tilt, surface_azimuth, solar_zenith,
580
377
 
581
378
  def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth,
582
379
  gcr, height, pitch, ghi, dhi, dni,
583
- albedo, iam_front=1.0, iam_back=1.0,
584
- bifaciality=0.8, shade_factor=-0.02,
585
- transmission_factor=0, npoints=100):
380
+ albedo, model='isotropic', dni_extra=None, iam_front=1.0,
381
+ iam_back=1.0, bifaciality=0.8, shade_factor=-0.02,
382
+ transmission_factor=0, npoints=100, vectorize=False):
586
383
  """
587
384
  Get front and rear irradiance using the infinite sheds model.
588
385
 
@@ -643,6 +440,13 @@ def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth,
643
440
  albedo : numeric
644
441
  Surface albedo. [unitless]
645
442
 
443
+ model : str, default 'isotropic'
444
+ Irradiance model - can be one of 'isotropic' or 'haydavies'.
445
+
446
+ dni_extra : numeric, optional
447
+ Extraterrestrial direct normal irradiance. Required when
448
+ ``model='haydavies'``. [W/m2]
449
+
646
450
  iam_front : numeric, default 1.0
647
451
  Incidence angle modifier, the fraction of direct irradiance incident
648
452
  on the front surface that is not reflected away. [unitless]
@@ -666,7 +470,12 @@ def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth,
666
470
  etc. A negative value is a reduction in back irradiance. [unitless]
667
471
 
668
472
  npoints : int, default 100
669
- Number of points used to discretize distance along the ground.
473
+ Number of discretization points for calculating integrated view
474
+ factors.
475
+
476
+ vectorize : bool, default False
477
+ If True, vectorize the view factor calculation across ``surface_tilt``.
478
+ This increases speed with the cost of increased memory usage.
670
479
 
671
480
  Returns
672
481
  -------
@@ -720,13 +529,15 @@ def get_irradiance(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth,
720
529
  surface_tilt=surface_tilt, surface_azimuth=surface_azimuth,
721
530
  solar_zenith=solar_zenith, solar_azimuth=solar_azimuth,
722
531
  gcr=gcr, height=height, pitch=pitch, ghi=ghi, dhi=dhi, dni=dni,
723
- albedo=albedo, iam=iam_front, npoints=npoints)
532
+ albedo=albedo, model=model, dni_extra=dni_extra, iam=iam_front,
533
+ npoints=npoints, vectorize=vectorize)
724
534
  # back side POA irradiance
725
535
  irrad_back = get_irradiance_poa(
726
536
  surface_tilt=backside_tilt, surface_azimuth=backside_sysaz,
727
537
  solar_zenith=solar_zenith, solar_azimuth=solar_azimuth,
728
538
  gcr=gcr, height=height, pitch=pitch, ghi=ghi, dhi=dhi, dni=dni,
729
- albedo=albedo, iam=iam_back, npoints=npoints)
539
+ albedo=albedo, model=model, dni_extra=dni_extra, iam=iam_back,
540
+ npoints=npoints, vectorize=vectorize)
730
541
 
731
542
  colmap_front = {
732
543
  'poa_global': 'poa_front',