Skip to content

Issue#144-fixed the azimuth calculation of rotated PV panel #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 13, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions pvlib/test/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_axis_tilt():
max_angle=90, backtrack=True,
gcr=2.0/7.0)

expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 37.3427,
expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730,
'surface_tilt': 35.98741, 'tracker_theta': -20.88121},
index=[0], dtype=np.float64)

Expand All @@ -118,7 +118,7 @@ def test_axis_tilt():
max_angle=90, backtrack=True,
gcr=2.0/7.0)

expect = pd.DataFrame({'aoi': 47.6632, 'surface_azimuth': 129.0303,
expect = pd.DataFrame({'aoi': 47.6632, 'surface_azimuth': 50.96969,
'surface_tilt': 42.5152, 'tracker_theta': 31.6655},
index=[0], dtype=np.float64)

Expand Down Expand Up @@ -188,12 +188,31 @@ def test_SingleAxisTracker_tracking():

tracker_data = system.singleaxis(apparent_zenith, apparent_azimuth)

expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 37.3427,
expect = pd.DataFrame({'aoi': 7.286245, 'surface_azimuth': 142.65730 ,
'surface_tilt': 35.98741, 'tracker_theta': -20.88121},
index=[0], dtype=np.float64)

assert_frame_equal(expect, tracker_data)

### results calculated using PVsyst
pvsyst_solar_azimuth = 7.1609
pvsyst_solar_height = 27.315
pvsyst_axis_tilt = 20.
pvsyst_axis_azimuth = 20.
system.backtrack = False
system.max_angle = 60.
system.axis_tilt = pvsyst_axis_tilt
system.axis_azimuth = 180+pvsyst_axis_azimuth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be more clear what's actually being tested if you make these assignments when the object is created.

apparent_azimuth = pd.Series([180+pvsyst_solar_azimuth]) # the definition of azimuth is different from PYsyst
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long, move the comment to line above

apparent_zenith = pd.Series([90-pvsyst_solar_height])
tracker_data = system.singleaxis(apparent_zenith, apparent_azimuth)
expect = pd.DataFrame({'aoi': 41.07852 , 'surface_azimuth': 180-18.432 ,
'surface_tilt': 24.92122 , 'tracker_theta': -15.18391},
index=[0], dtype=np.float64)

assert_frame_equal(expect, tracker_data)



def test_LocalizedSingleAxisTracker_creation():
localized_system = tracking.LocalizedSingleAxisTracker(latitude=32,
Expand Down Expand Up @@ -254,7 +273,7 @@ def test_get_irradiance():
surface_azimuth=tracker_data['surface_azimuth'])

expected = pd.DataFrame(data=np.array(
[[ 142.71652464, 87.50125991, 55.21526473, 44.68768982,
[[ 961.80070, 815.94490, 145.85580, 135.32820,
10.52757492],
[ nan, nan, nan, nan,
nan]]),
Expand Down
3 changes: 2 additions & 1 deletion pvlib/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ def singleaxis(apparent_zenith, apparent_azimuth,

# 4. Rotate 0 reference from panel's x axis to it's y axis and
# then back to North.
surface_azimuth += 90 + axis_azimuth
# surface_azimuth += 90+ axis_azimuth
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to keep the old calculation in a comment.

surface_azimuth = 90-surface_azimuth + axis_azimuth

# 5. Map azimuth into [0,360) domain.
surface_azimuth[surface_azimuth<0] += 360
Expand Down