-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add gallery example for cross-axis slope backtracking #1077
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
Changes from 5 commits
f673ac5
64785ad
f84fb40
0da0d0f
6662505
9d24f61
3b75bb3
fe20f01
e1b4650
186232c
3320e19
cbb8fd1
5dd6d46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,168 @@ | ||||||||
| """ | ||||||||
| Backtracking on sloped terrain | ||||||||
| ============================== | ||||||||
|
|
||||||||
| Modeling backtracking for single-axis tracker arrays on sloped terrain. | ||||||||
| """ | ||||||||
|
|
||||||||
| # %% | ||||||||
| # Tracker systems avoid row-to-row shading when the sun is low in the sky | ||||||||
| # by backtracking. The backtracking strategy orients the modules exactly | ||||||||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| # on the boundary between shaded and unshaded so that the modules are oriented | ||||||||
| # as much towards the sun as possible while still remaining unshaded. | ||||||||
| # Unlike the truetracking calculation (which only depends on solar position), | ||||||||
|
||||||||
| # calculating the backtracking angle requires knowledge of the relative spacing | ||||||||
| # of adjacent tracker rows. This example shows how the backtracking angle | ||||||||
| # changes based on a vertical offset between rows caused by sloped terrain. | ||||||||
| # It uses :py:func:`pvlib.tracking.calc_axis_tilt` and | ||||||||
| # :py:func:`pvlib.tracking.calc_cross_axis_tilt` to calculate the necessary | ||||||||
| # array geometry parameters and :py:func:`pvlib.tracking.singleaxis` to | ||||||||
| # calculate the backtracking angles. | ||||||||
| # | ||||||||
| # Angle conventions | ||||||||
| # ----------------- | ||||||||
| # | ||||||||
| # First let's go over the sign conventions used for angles. In contrast to | ||||||||
| # fixed-tilt arrays, the convention for the azimuth angle of a single-axis | ||||||||
| # tracker array is along the tracker axis. Note that the axis azimuth is | ||||||||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| # a property of the array and is distinct from the azimuth of the panel | ||||||||
| # orientation, which changes based on tracker angle. | ||||||||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| # Because the tracker axis points in two directions, there are two choices for | ||||||||
| # the axis azimuth angle, and by convention (at least in the northern | ||||||||
| # hemisphere), the more southward angle is chosen: | ||||||||
| # | ||||||||
| # .. image:: ../_images/tracker_azimuth_angle_convention.png | ||||||||
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| # :alt: Image showing the azimuth convention for single-axis tracker arrays. | ||||||||
| # :width: 500 | ||||||||
| # :align: center | ||||||||
| # | ||||||||
| # Note that, as with fixed-tilt arrays, the axis azimuth is determined as the | ||||||||
| # angle clockwise from north. | ||||||||
| # | ||||||||
| # Using the axis azimuth convention above, the sign convention for tracker | ||||||||
| # rotations is given by the | ||||||||
| # `right-hand rule <https://en.wikipedia.org/wiki/Right-hand_rule>`_. | ||||||||
| # Point the right hand thumb along the axis in the direction of the axis | ||||||||
| # azimuth and the fingers curl in the direction of positive rotation angle: | ||||||||
| # | ||||||||
| # .. image:: ../_images/tracker_rotation_angle_convention.png | ||||||||
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| # :alt: Image showing the rotation sign convention for single-axis trackers. | ||||||||
| # :width: 500 | ||||||||
| # :align: center | ||||||||
| # | ||||||||
| # So for an array with ``axis_azimuth=180`` (tracker axis aligned perfectly | ||||||||
| # north-south), pointing the right-hand thumb along the axis azimuth has the | ||||||||
| # fingers curling towards the west, meaning rotations towards the west are | ||||||||
| # positive and rotations towards the east are negative. | ||||||||
| # | ||||||||
| # The sign convention for ground slope follows the same convention -- align | ||||||||
| # the right-hand thumb along the tracker axis in the direction of the axis | ||||||||
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
| # azimuth and the fingers curl towards positive angles. So in this example, | ||||||||
| # with the axis azimuth coming out of the page, an east-facing slope is a | ||||||||
| # negative rotation from horizontal: | ||||||||
kandersolar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||
| # | ||||||||
| # .. image:: ../_images/ground_slope_angle_convention.png | ||||||||
| # :alt: Image showing the ground slope sign convention. | ||||||||
| # :width: 500 | ||||||||
| # :align: center | ||||||||
| # | ||||||||
|
|
||||||||
| # %% | ||||||||
| # Rotation curves | ||||||||
| # --------------- | ||||||||
| # | ||||||||
| # Now, let's plot the simple case where the tracker axes are at right angles | ||||||||
| # to the direction of the slope. In this case, the cross-axis tilt angle | ||||||||
| # is the same as the slope of the terrain and the tracker axis itself is | ||||||||
| # horizontal. | ||||||||
|
|
||||||||
| from pvlib import solarposition, tracking | ||||||||
| import pandas as pd | ||||||||
| import matplotlib.pyplot as plt | ||||||||
|
|
||||||||
| # PV system parameters | ||||||||
| tz = 'US/Eastern' | ||||||||
| lat, lon = 40, -80 | ||||||||
| gcr = 0.4 | ||||||||
|
|
||||||||
| # calculate the solar position | ||||||||
| times = pd.date_range('2019-01-01 06:00', '2019-01-01 18:00', closed='left', | ||||||||
| freq='1min', tz=tz) | ||||||||
| solpos = solarposition.get_solarposition(times, lat, lon) | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rendered version has some weird syntax highlighting inconsistencies. I don't see anything wrong so probably safe to ignore.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're talking about things being rendered blue-ish with clickable links, I think that's the intersphinx linking: https://sphinx-gallery.github.io/stable/configuration.html#add-intersphinx-links-to-your-examples Future improvement: configure pvlib functions to link as well, or disable it for everything, for consistency.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
|
|
||||||||
| # compare the backtracking angle at various terrain slopes | ||||||||
| fig, ax = plt.subplots() | ||||||||
| for cross_axis_tilt in [0, 5, 10]: | ||||||||
| tracker_data = tracking.singleaxis( | ||||||||
| apparent_zenith=solpos['apparent_zenith'], | ||||||||
| apparent_azimuth=solpos['azimuth'], | ||||||||
| axis_tilt=0, # flat because the axis is perpendicular to the slope | ||||||||
| axis_azimuth=180, # N-S axis, azimuth facing south | ||||||||
| max_angle=90, | ||||||||
| backtrack=True, | ||||||||
| gcr=gcr, | ||||||||
| cross_axis_tilt=cross_axis_tilt) | ||||||||
|
|
||||||||
| backtracking_position = tracker_data['tracker_theta'].fillna(0) | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| label = 'cross-axis tilt: {}°'.format(cross_axis_tilt) | ||||||||
| backtracking_position.plot(label=label, ax=ax) | ||||||||
|
|
||||||||
| plt.legend() | ||||||||
| plt.title('Backtracking Curves') | ||||||||
| plt.show() | ||||||||
|
|
||||||||
| # %% | ||||||||
| # This plot shows how backtracking changes based on the slope between rows. | ||||||||
| # For example, unlike the flat-terrain backtracking curve, the sloped-terrain | ||||||||
| # curves do not approach zero at the end of the day. Because of the vertical | ||||||||
| # offset between rows introduced by the sloped terrain, the trackers can be | ||||||||
| # slightly tilted without shading each other. | ||||||||
| # | ||||||||
| # Now let's examine the general case where the terrain slope makes an | ||||||||
| # inconvenient angle to the tracker axes. For example, consider an array | ||||||||
| # with north-south axes on terrain that slopes down to the south-south-east. | ||||||||
| # Assuming the axes are installed parallel to the ground, the northern ends | ||||||||
| # of the axes will be higher than the southern ends. But because the slope | ||||||||
| # isn't purely parallel or perpendicular to the axes, the axis tilt and | ||||||||
| # cross-axis tilt angles are not immediately obvious. We can use pvlib | ||||||||
| # to calculate them for us: | ||||||||
|
|
||||||||
| slope_azimuth = 155 # terrain slopes down to the south-south-east | ||||||||
| slope_tilt = 10 # terrain is sloped at 10 degrees from horizontal | ||||||||
|
||||||||
| slope_azimuth = 155 # terrain slopes down to the south-south-east | |
| slope_tilt = 10 # terrain is sloped at 10 degrees from horizontal | |
| slope_tilt = 10 # terrain slopes upward 10 degrees from horizontal in the direction of slope_azimuth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If slope_tilt is 10 degrees relative to horizontal along slope_azimuth,
Correct, but I think your suggested comment has the wrong sign. It's either upwards 10 degrees away from slope_azimuth, or downward 10 degrees towards it. Are you okay with this revision?
terrain slopes upward 10 degrees from horizontal away from the direction of slope_azimuth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slope_azimuth is chosen in the downslope direction? I may have missed that if it's earlier in the text. If not, would be good to add. If slope_azimuth is always downslope, then I think it may be more clear to describe slope_tilt in the direction of slope_azimuth, i.e., always negative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience with this reviewer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made. As always, I am grateful for the review :)

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reads like a module docstring but renders as regular text, so I think the rendered introduction is awkward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's awkward in the rendered page. The reason for the strange wording is the docstring-style line is also used as the hover text for the thumbnail in the gallery listing, which has to be brief. Open to suggestions for text that works better in both contexts!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a gallery configuration problem. Let's ignore.