Skip to content

Commit 6a9fc83

Browse files
committed
Merge pull request #145 from mayudong/master
Issue#144-fixed the azimuth calculation of rotated PV panel
2 parents 566a1e1 + 4bf2d3a commit 6a9fc83

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

docs/sphinx/source/whatsnew/v0.3.1.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ Bug fixes
2222
sense PV array voltage. The model was erroneously comparing Ps0 with
2323
the AC output power (ac_power), rather than the DC input power (p_dc).
2424

25-
25+
* Fixed the azimuth calculation of rotated PV panel in function
26+
pvlib.tracking.singleaxis(...) so that the results are consistent
27+
with PVsyst
2628
Contributors
2729
~~~~~~~~~~~~
2830

2931
* ejmiller2
32+
* Yudong Ma

pvlib/test/test_tracking.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_axis_tilt():
107107
max_angle=90, backtrack=True,
108108
gcr=2.0/7.0)
109109

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

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

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

@@ -188,12 +188,32 @@ def test_SingleAxisTracker_tracking():
188188

189189
tracker_data = system.singleaxis(apparent_zenith, apparent_azimuth)
190190

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

195195
assert_frame_equal(expect, tracker_data)
196196

197+
### results calculated using PVsyst
198+
pvsyst_solar_azimuth = 7.1609
199+
pvsyst_solar_height = 27.315
200+
pvsyst_axis_tilt = 20.
201+
pvsyst_axis_azimuth = 20.
202+
pvsyst_system = tracking.SingleAxisTracker(max_angle=60.,
203+
axis_tilt=pvsyst_axis_tilt,
204+
axis_azimuth=180+pvsyst_axis_azimuth,
205+
backtrack=False)
206+
# the definition of azimuth is different from PYsyst
207+
apparent_azimuth = pd.Series([180+pvsyst_solar_azimuth])
208+
apparent_zenith = pd.Series([90-pvsyst_solar_height])
209+
tracker_data = pvsyst_system.singleaxis(apparent_zenith, apparent_azimuth)
210+
expect = pd.DataFrame({'aoi': 41.07852 , 'surface_azimuth': 180-18.432 ,
211+
'surface_tilt': 24.92122 , 'tracker_theta': -15.18391},
212+
index=[0], dtype=np.float64)
213+
214+
assert_frame_equal(expect, tracker_data)
215+
216+
197217

198218
def test_LocalizedSingleAxisTracker_creation():
199219
localized_system = tracking.LocalizedSingleAxisTracker(latitude=32,
@@ -254,7 +274,7 @@ def test_get_irradiance():
254274
surface_azimuth=tracker_data['surface_azimuth'])
255275

256276
expected = pd.DataFrame(data=np.array(
257-
[[ 142.71652464, 87.50125991, 55.21526473, 44.68768982,
277+
[[ 961.80070, 815.94490, 145.85580, 135.32820,
258278
10.52757492],
259279
[ nan, nan, nan, nan,
260280
nan]]),

pvlib/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def singleaxis(apparent_zenith, apparent_azimuth,
485485

486486
# 4. Rotate 0 reference from panel's x axis to it's y axis and
487487
# then back to North.
488-
surface_azimuth += 90 + axis_azimuth
488+
surface_azimuth = 90-surface_azimuth + axis_azimuth
489489

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

0 commit comments

Comments
 (0)