Front-side irradiance is not affected by horizon_band_angle
Changing the horizon_band_angle input to HybridPerezOrdered doesn't seem to affect front-side irradiance nearly as much as it does rear-side. Code to reproduce:
from pvfactors.geometry import OrderedPVArray
from pvfactors.engine import PVEngine
from pvfactors.irradiance.models import HybridPerezOrdered
import pandas as pd
import numpy as np
times = pd.to_datetime(['2019-06-01 12:00'])
dni = np.array([600])
dhi = np.array([100])
solar_zenith = np.array([45])
solar_azimuth = np.array([270])
surface_tilt = np.array([45])
surface_azimuth = np.array([270])
albedo = np.array([0.25])
def build_report(pvarray):
row = pvarray.ts_pvrows[1]
return {
'front': row.front.get_param_weighted('qabs')[0],
'back': row.back.get_param_weighted('qabs')[0],
}
for band_angle in [5, 15]:
irradiance_model = HybridPerezOrdered(horizon_band_angle=band_angle)
pvarray = OrderedPVArray(n_pvrows=3, pvrow_height=1, pvrow_width=1, axis_azimuth=180, gcr=0.5)
engine = PVEngine(pvarray, irradiance_model=irradiance_model)
engine.fit(times, dni, dhi, solar_zenith, solar_azimuth, surface_tilt, surface_azimuth, albedo)
out = engine.run_full_mode(fn_build_report=build_report)
print(f'band_angle = {band_angle}\t-->', out)
band_angle = 5 --> {'front': 737.1206177322375, 'back': 43.08209190810574}
band_angle = 15 --> {'front': 737.1517229315606, 'back': 50.38605014260793}
Looking at HybridPerezOrdered.transform, I guess the horizon band shading calculation for the front is done differently from the rear. In fact it's not clear to me that horizon band shading is calculated at all for the front side, but maybe I'm missing it. If it is, I would naively expect horizon band shading loss to be more or less the same for front and rear side. @anomam any thoughts? :)
hey @kanderso-nrel , sorry for the delay.
That's a good catch! And it's quite clearly shown here: https://github.com/SunPower/pvfactors/blob/master/pvfactors/irradiance/models.py#L697-L698
It's been a very long time and I feel like there was a reason we didn't do it then, but I can't quite remember. Maybe it was for computation speed, or because the implementations we made didn't fit well the data we had, or just because SunPower at that time only cared about backside irradiance, not exactly sure...
In any case, I think we should make sure pvfactors stays consistent, and it would be nice to have an implementation for it... I don't think I'll have the bandwidth to lead this in the near future (I wasn't even able to add type hints like I was hoping for during the holiday...), but if anyone wants to take a stab at it I'd be happy to review.