You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Low sun angles with a tilted tracking axis cause an error in the backtracking calculation. Code attempts arcos() of a value outside [-1, 1]
To Reproduce
from pvlib.tracking import singleaxis
result = singleaxis(apparent_zenith=80, apparent_azimuth=338, axis_tilt=30,
axis_azimuth=180, max_angle=60, backtrack=True, gcr=0.35)
Expected behavior
tracker angle should set to max_angle
I was wondering why the issue says the expected outcome was that it should be at the max angle, but the test merged for this shows the output as -50.31051385 - was that a typo, and meant to say, "expected outcome not max angle?"
If I remember correctly, these inputs produced nan before the fix in #697. It's not obvious to me that the expected outcome for these inputs should be max_angle. Maybe the expected outcome in the original post should have stated "tracker angle should be between 0 and +/- max_angle". Or maybe the fix was incomplete. @mikofski do you think the output is wrong?
TIL that when the tracker axes are tilted, it's possible for the sun to come from below the trackers, in their reference frame, something I never even considered until I started looking into these low sun angles.
mikofski do you think the output is wrong?
Yes, I believe it may be wrong. I believe the tracker does not need to backtrack, but it is rotating past the max angle of 90[deg] so it's rotation should be 90[deg], and the AOI calculated from that.
I don't think it needs to backtrack because if you turn off backtracking and set the max angle to 180[deg], then it yields:
I think the tracker axis tilt and low sun angle have combined to put the sun below the tracker. I don't think it shades the next tracker, but it has exceeded the max angle.
If the sun is below the tracker then the shadow of the tracker is cast upwards and would shade the top of the next tracker if the shadow's length LR = L/cos(pi-R) were greater than the pitch between rows, P = L/GCR, so LR > P is the same as cos(pi-R) < GCR, But cos(pi-R) = -cos(R) = -cos(129.7) = 0.64 > 0.35 so no backtracking.
I put together a gist to explain what I think is going on. Basically when R is grater than 90[deg] then the condition for backtracking changes because the sun is now below the trackers, and the angle to calculate LR is now pi - R, otherwise the length is negative.
The patch applied in #697 also sees cos(R)/gcr < 1 but the np.clip sets the backtracking to 180 because np.arccos(-1) = 180.
IMHO the trackers would not backtrack all the way to the east, unless this was a special bifacial tracking solution. For monofacial trackers I think they would stop at the stow position.
that when the tracker axes are tilted, it's possible for the sun to come from below the trackers
It's possible that this happens under very restricted conditons: the sun has to be behind all possible planes to which the modules could be rotated, which would restrict the sun to a relatively narrow "triangle" of azimuth (base) and elevation (height) centered at north azimuth (for a north-south tracker). Do you think we've got a case where this happens?
Yes, I think this particular case of the 30deg tilted tracker and the low sun angle leads to the rays coming from below the trackers in their reference frame. If you check the solar angle in the yz place it's 10deg, but the tracker is tilted 30deg. If you rotate the solar vector into the tracker reference frame you get the sun in x'z' plane coming in 39.7deg below the tracker. That's why your get a tracker rotation of 129.7deg (=90+39.7) if you turn off backtracking and set max angle to 180deg.
Activity
kevinsa5 commentedon Feb 7, 2019
I admit I have not read the reference paper, nor do I fully understand the algorithm implementation, but I believe the snippet of interest is this:
pvlib-python/pvlib/tracking.py
Lines 422 to 431 in d621327
Changing
tempto be constrained on both sides appears to solve the issue:temp = np.clip(axes_distance*cosd(wid), -1, 1)mikofski commentedon Nov 20, 2019
I was wondering why the issue says the expected outcome was that it should be at the max angle, but the test merged for this shows the output as -50.31051385 - was that a typo, and meant to say, "expected outcome not max angle?"
wholmgren commentedon Nov 20, 2019
If I remember correctly, these inputs produced
nanbefore the fix in #697. It's not obvious to me that the expected outcome for these inputs should be max_angle. Maybe the expected outcome in the original post should have stated "tracker angle should be between 0 and +/- max_angle". Or maybe the fix was incomplete. @mikofski do you think the output is wrong?mikofski commentedon Nov 21, 2019
TIL that when the tracker axes are tilted, it's possible for the sun to come from below the trackers, in their reference frame, something I never even considered until I started looking into these low sun angles.
Yes, I believe it may be wrong. I believe the tracker does not need to backtrack, but it is rotating past the max angle of 90[deg] so it's rotation should be 90[deg], and the AOI calculated from that.
I don't think it needs to backtrack because if you turn off backtracking and set the max angle to 180[deg], then it yields:
{'tracker_theta': array([129.68948615]), 'aoi': array([61.35300178]), 'surface_azimuth': array([292.53615425]), 'surface_tilt': array([56.42233095])}I think the tracker axis tilt and low sun angle have combined to put the sun below the tracker. I don't think it shades the next tracker, but it has exceeded the max angle.
If the sun is below the tracker then the shadow of the tracker is cast upwards and would shade the top of the next tracker if the shadow's length
LR = L/cos(pi-R)were greater than the pitch between rows,P = L/GCR, soLR > Pis the same ascos(pi-R) < GCR, Butcos(pi-R) = -cos(R) = -cos(129.7) = 0.64 > 0.35so no backtracking.I put together a gist to explain what I think is going on. Basically when R is grater than 90[deg] then the condition for backtracking changes because the sun is now below the trackers, and the angle to calculate LR is now
pi - R, otherwise the length is negative.The patch applied in #697 also sees
cos(R)/gcr < 1but thenp.clipsets the backtracking to 180 becausenp.arccos(-1) = 180.IMHO the trackers would not backtrack all the way to the east, unless this was a special bifacial tracking solution. For monofacial trackers I think they would stop at the stow position.
mikofski commentedon Nov 21, 2019
Moreover, I think this AOI is for the backside that is still facing west.
cwhanse commentedon Nov 21, 2019
It's possible that this happens under very restricted conditons: the sun has to be behind all possible planes to which the modules could be rotated, which would restrict the sun to a relatively narrow "triangle" of azimuth (base) and elevation (height) centered at north azimuth (for a north-south tracker). Do you think we've got a case where this happens?
mikofski commentedon Nov 21, 2019
Yes, I think this particular case of the 30deg tilted tracker and the low sun angle leads to the rays coming from below the trackers in their reference frame. If you check the solar angle in the yz place it's 10deg, but the tracker is tilted 30deg. If you rotate the solar vector into the tracker reference frame you get the sun in x'z' plane coming in 39.7deg below the tracker. That's why your get a tracker rotation of 129.7deg (=90+39.7) if you turn off backtracking and set max angle to 180deg.