question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect AOI from pvlib.tracking.singleaxis

See original GitHub issue

pvlib.tracking.singleaxis produces an incorrect AOI when the sun is above the earth horizon but behind the module plane.

To Reproduce Model a fixed tilt system (90 tilt, 180 azimuth) and compare to a vertical single axis tracker with very small rotation limit.


import pandas as pd
import pytz
import pvlib
from matplotlib import pyplot as plt

loc = pvlib.location.Location(40.1134, -88.3695)

dr = pd.date_range(start='02-Jun-1998 00:00:00', end='02-Jun-1998 23:55:00',
                   freq='5T')
tz = pytz.timezone('Etc/GMT+6')
dr = dr.tz_localize(tz)
hr = dr.hour + dr.minute/60

sp = loc.get_solarposition(dr)

cs = loc.get_clearsky(dr)

tr = pvlib.tracking.singleaxis(sp['apparent_zenith'], sp['azimuth'],
                               axis_tilt=90, axis_azimuth=180, max_angle=0.01,
                               backtrack=False)

fixed = pvlib.irradiance.aoi(90, 180, sp['apparent_zenith'], sp['azimuth'])

plt.plot(hr, fixed)
plt.plot(hr, tr['aoi'])
plt.plot(hr, sp[['apparent_elevation']])
plt.show()

plt.legend(['aoi - fixed', 'aoi - tracked', 'apparent_elevation'])

Expected behavior The AOI for the fixed tilt system shows values greater than 90 when the sun is behind the module plane. The AOI from singleaxis does not.

I think the source of the error is the use of abs in this line.

Screenshots aoi_fixed_vs_tracked

Versions:

  • pvlib.__version__: 0.8.1

First reported by email from Jim Wilzcak (NOAA) for the PVlib Matlab function pvl_singleaxis.m

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kanderso-nrelcommented, Aug 7, 2021

Should we just replace that entire line with a call to irradiance.aoi?

1reaction
wholmgrencommented, May 12, 2021

Yes, my initial port of the matlab code was as close to 1:1 as I could make it. I don’t recall second guessing the abs at the time, but I certainly should have.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pvlib.tracking.singleaxis — pvlib python 0.9.3 documentation
Determine the rotation angle of a single-axis tracker when given particular solar zenith and azimuth angles. See 1 for details about the equations....
Read more >
pvlib.tracking.SingleAxisTracker
A class for single-axis trackers that inherits the PV modeling methods from PVSystem . For details on calculating tracker rotation see ...
Read more >
pvlib.tracking.singleaxis
Determine the rotation angle of a single-axis tracker when given particular solar zenith and azimuth angles. See 1 for details about the equations....
Read more >
pvlib.tracking — pvlib python 0.9.3 documentation
See also -------- pvlib.tracking.singleaxis pvlib.tracking.calc_axis_tilt ... Returns ------- aoi : Series The angle of incidence in degrees from normal.
Read more >
pvlib.tracking.SingleAxisTracker
class pvlib.tracking. ... False denotes no backtrack capability. ... A tracker system with modules 2 meters wide, centered on the tracking axis, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found