NREL / bifacialvf

Bifacial PV View Factor model for system performance calculation
https://bifacialvf.readthedocs.io
Other
29 stars 18 forks source link

running SeqAOIcor list out of range #53

Open Nitzan-hez opened 1 year ago

Nitzan-hez commented 1 year ago

Hi,

I had some issues on front irradiation calculation that SegAOIcor[index][j] get out of index when j>180, although SeqAOIcor[index] length is 180.

 for j in range (0, iStopIso):                                        # Add sky diffuse component and horizon brightening if present

    frontGTI[i] += 0.5 * (math.cos(j * DTOR) - math.cos((j + 1) * DTOR)) * SegAOIcor[index][j] * iso_sky_dif;                # Sky radiation
    frontReflected[i] += 0.5 * (math.cos(j * DTOR) - math.cos((j + 1) * DTOR)) * iso_sky_dif * (1.0 - SegAOIcor[index][j] * (1.0 - Ro));  

     if ((iStopIso - j) <= iHorBright):                                   # Add horizon brightening term if seen

        frontGTI[i] += 0.5 * (math.cos(j * DTOR) - math.cos((j + 1) * DTOR)) * SegAOIcor[index][j] * F2DHI / 0.052264;  
        frontReflected[i] += 0.5 * (math.cos(j * DTOR) - math.cos((j + 1) * DTOR)) * (F2DHI / 0.052264) * (1.0 - SegAOIcor[index][j] * (1.0 - Ro));    

I won't pretend to be too familiar the code, but I think I solved it by limiting iStopIso to 180 at most (it also it sound physically logic).. see below:

iStopIso =min(int(round(np.float64((math.pi - beta - elvUP)) / DTOR)), 180)   # Last whole degree in arc range that sees sky, first is 0

instead of:

iStopIso =int(round(np.float64((math.pi - beta - elvUP)) / DTOR))   # Last whole degree in arc range that sees sky, first is 0