Skip to content

Commit b008c90

Browse files
committed
revert row_sky and row_ground to original definitions
the crossed-strings math assumed x0=0, x1=1. I am confident it could be extended to other endpoints, but reverting this for now.
1 parent c0ddd61 commit b008c90

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

pvlib/bifacial/utils.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,14 @@ def vf_row_sky_2d_integ(surface_tilt, gcr, x0=0, x1=1):
345345
from x0 to x1. [unitless]
346346
347347
'''
348-
result = 0.5 * (1/gcr + 1 - ((1/gcr)**2 - (2/gcr)*cosd(surface_tilt) + 1)**0.5)
348+
u = np.abs(x1 - x0)
349+
p0 = _vf_poly(surface_tilt, gcr, 1 - x0, -1)
350+
p1 = _vf_poly(surface_tilt, gcr, 1 - x1, -1)
351+
with np.errstate(divide='ignore'):
352+
result = np.where(u < 1e-6,
353+
vf_row_sky_2d(surface_tilt, gcr, x0),
354+
0.5*(1 + 1/u * (p1 - p0))
355+
)
349356
return result
350357

351358

@@ -409,5 +416,12 @@ def vf_row_ground_2d_integ(surface_tilt, gcr, x0=0, x1=1):
409416
[unitless]
410417
411418
'''
412-
result = 0.5 * (1/gcr + 1 - ((1/gcr)**2 + (2/gcr)*cosd(surface_tilt) + 1)**0.5)
419+
u = np.abs(x1 - x0)
420+
p0 = _vf_poly(surface_tilt, gcr, x0, 1)
421+
p1 = _vf_poly(surface_tilt, gcr, x1, 1)
422+
with np.errstate(divide='ignore'):
423+
result = np.where(u < 1e-6,
424+
vf_row_ground_2d(surface_tilt, gcr, x0),
425+
0.5*(1 - 1/u * (p1 - p0))
426+
)
413427
return result

0 commit comments

Comments
 (0)