8000 Projected zenith convenience function by echedey-ls · Pull Request #1904 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Projected zenith convenience function #1904

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
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
1e412ce
Function prototype
echedey-ls Nov 6, 2023
e4a95a3
Update shading.rst
echedey-ls Nov 6, 2023
54878db
Update shading.py
echedey-ls Nov 6, 2023
b79ebe6
Minimal test
echedey-ls Nov 6, 2023
c3c0e56
Implementation
echedey-ls Nov 8, 2023
5d4a2b4
Fix, fix, fix, fix & format
echedey-ls Nov 8, 2023
9ae5fa3
Format issues
echedey-ls Nov 8, 2023
f17379d
Extend tests (compare with singleaxis) & format with ruff
echedey-ls Nov 8, 2023
af3d27c
Format fixes
echedey-ls Nov 8, 2023
d36841a
Upgrade tests
echedey-ls Nov 9, 2023
19995e1
Array -> Axis
echedey-ls Nov 9, 2023
770e037
type
echedey-ls Nov 9, 2023
29bcef9
Whatsnew
echedey-ls Nov 9, 2023
61c2e3b
xd
echedey-ls Nov 9, 2023
935cfd4
Merge branch 'main' into projected-solar-zenith-angle-issue1734
echedey-ls Nov 9, 2023
965b0b4
bruh
echedey-ls Nov 9, 2023
346d060
Minor Python optimization a la tracking.singleaxis
echedey-ls Nov 9, 2023
085d017
Comment and minor optimizations
echedey-ls Nov 9, 2023
79b5f4f
Typo found by Mikofski
echedey-ls Nov 9, 2023
dc1035a
Surface -> Axis
echedey-ls Nov 9, 2023
88cbfc0
Elevation -> Zenith
echedey-ls Nov 9, 2023
1afec94
Elev -> Zenith
echedey-ls Nov 9, 2023
4b2c0e5
Update shading.py
echedey-ls Jan 24, 2024
4612442
Update docstring
echedey-ls Jan 24, 2024
6372cb7
Add comments from `tracking.singleaxis`
echedey-ls Jan 24, 2024
3c9392b
Singleaxis implementation port & test addition, based on old pvlib.tr…
echedey-ls Jan 25, 2024
93998d8
Merge branch 'main' into projected-solar-zenith-angle-issue1734
echedey-ls Jan 25, 2024
337f7f1
Update v0.10.4.rst
echedey-ls Jan 25, 2024
0923109
Linter
echedey-ls Jan 25, 2024
6955f71
Code review
echedey-ls Jan 25, 2024
939b241
Add Fig 5 [1] (still gotta check the built output)
echedey-ls Jan 27, 2024
b0d6f66
Add caption, change size and describe in alternate text
echedey-ls Jan 27, 2024
3df2e71
rST fixes ?
echedey-ls Jan 27, 2024
428852c
Figures have captions, images do not
echedey-ls Jan 27, 2024
64c97c7
Merge branch 'main' into projected-solar-zenith-angle-issue1734
echedey-ls Feb 8, 2024
aed85a3
Flip arguments order
echedey-ls Feb 8, 2024
5d37fb3
I forgot :skull:
echedey-ls Feb 8, 2024
38c2d4d
Linter are you happy now?
echedey-ls Feb 8, 2024
23aaa2a
Remove port test and add edge cases test
echedey-ls Feb 9, 2024
2c0fa51
Update test_shading.py
echedey-ls Feb 9, 2024
5b49706
Indentation xd
echedey-ls Feb 9, 2024
1a68390
Update test_shading.py
echedey-ls Feb 9, 2024
58d853f
I forgot how to code
echedey-ls Feb 9, 2024
2ba4cf7
Align data
echedey-ls Feb 9, 2024
8325c37
Merge branch 'main' into projected-solar-zenith-angle-issue1734
echedey-ls Feb 24, 2024
f2fcc88
Merge branch 'main' into projected-solar-zenith-angle-issue1734
echedey-ls Feb 27, 2024
069688e
Docstring suggestion from Kevin
echedey-ls Feb 27, 2024
c249224
Update link to example?
echedey-ls Feb 27, 2024
f6c245f
Link, please work
echedey-ls Feb 27, 2024
b52f51d
Update shading.py
echedey-ls Feb 27, 2024
96ce603
Update shading.py
echedey-ls Feb 28, 2024
ff42463
Update shading.py
echedey-ls Feb 28, 2024
1c28e7f
Update shading.py
echedey-ls Feb 28, 2024
cd346e9
Update shading.py
echedey-ls Feb 28, 2024
796c7a9
Update shading.py
echedey-ls Feb 28, 2024
761750c
Update shading.py
echedey-ls Feb 28, 2024
2be29f2
Update shading.py
echedey-ls Feb 28, 2024
8beef55
Lintaaaaaaarrrgh
echedey-ls Feb 28, 2024
5e2be60
Update pvlib/shading.py
echedey-ls Mar 4, 2024
3c5308b
Merge branch 'main' into projected-solar-zenith-angle-issue1734
kandersolar Mar 8, 2024
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
Prev Previous commit
Next Next commit
Surface -> Axis
Co-Authored-By: Kevin Anderson <57452607+kandersolar@users.noreply.github.com>
  • Loading branch information
echedey-ls and kandersolar committed Nov 9, 2023
commit dc1035abbbc45861efa1db0beaf442bf996f5dd1
20 changes: 10 additions & 10 deletions pvlib/shading.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def sky_diffuse_passias(masking_angle):
return 1 - cosd(masking_angle/2)**2


def projected_solar_zenith_angle(surface_tilt, surface_azimuth,
def projected_solar_zenith_angle(axis_tilt, axis_azimuth,
solar_apparent_elevation, solar_azimuth):
r"""
Calculate projected solar zenith angle in degrees.
Expand All @@ -243,9 +243,9 @@ def projected_solar_zenith_angle(surface_tilt, surface_azimuth,

Parameters
----------
surface_tilt : numeric
axis_tilt : numeric
Copy link
Member

Choose a reason for hiding this comment

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

For a general purpose function, would plane_tilt be more appropriate? And similar for azimuth.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a comment up there from @kandersolar asking for changes from surface_* to axis_* prefixes. I think surface is a close synonym of plane? So I'm unsure of applying that suggestion.

I'll request reviews for the current reviewers hoping they also give some insight regarding this. Anyway, if you are sure of it, I change it without no problems.

Copy link
Member

Choose a reason for hiding this comment

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

Is the issue that axis_tilt doesn't suggest that the equations are equally applicable to fixed tilt arrays?

I'm inclined (pun intended) to keep the term axis_tilt here. I think it's a useful, although perhaps not obvious at first, point of view to consider FT as a subset/special case of SAT anyway, in which case axis_tilt is the relevant quantity even for fixed tilt.

Perhaps a good compromise is to clarify that point in the parameter description/Notes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like these two terms refer to pure maths, and mapping those words to concise real-world systems is a bit counter-productive due to the variability. Is there some generic -maths- term we can use for a general description of this, a projection? Like basis, maybe? There's always a beautiful open paper backing the procedure and explaining what it does thoroughly. How the tracker works is up to the user or the other functions.

Just to weight in some more options outside of the current frame:
tracker_* (but this suggests everything except FT, right?), collector_*, reference_*, system_*, projection_system_*, coordinate_system_*, reference_system_*, basis_*, projection_basis_*... whatever other constructs you may think of.

Perhaps a good compromise is to clarify that point in the parameter description/Notes?

I don't dislike this possibility if we don't agree on anything else eventually, but we are overcomplicating the docs IMHO.

BTW, I'm +1 for the basis_*, projection_basis_* options. Anyway, remember I have 0 experience in PV outside of this repo.

Copy link
Member

Choose a reason for hiding this comment

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

I admit to suffering from tunnel vision for trackers, but in my view axis_ is still the best suggested prefix thus far. I think no matter what prefix we choose, we're going to have to include some kind of explanation/clarification. So IMHO we might as well choose axis_ for consistency with the reference and other pvlib functions.

How about:

    axis_tilt : numeric
        Tilt from horizontal of the coordinate axis pointing along the tracker
        torque tube (or along the length of a fixed-tilt row). [degrees]

Similar for axis_azimuth. And then a Notes section:

    Notes
    -----
    Although the cited reference derives the equations in the context of
    single-axis tracking arrays, the math is also applicable to fixed-tilt
    arrays.  For example, a south-facing fixed-tilt array on level
    terrain would have ``axis_tilt=0`` and ``axis_azimuth=90``.

Axis tilt angle in degrees. From horizontal plane to array plane.
surface_azimuth : numeric
axis_azimuth : numeric
Axis azimuth angle in degrees.
North = 0°; East = 90°; South = 180°; West = 270°
solar_apparent_elevation : numeric
Expand Down Expand Up @@ -274,21 +274,21 @@ def projected_solar_zenith_angle(surface_tilt, surface_azimuth,
"""
# Avoid recalculating these values
cosd_solar_apparent_elevation = cosd(solar_apparent_elevation)
cosd_surface_azimuth = cosd(surface_azimuth)
sind_surface_azimuth = sind(surface_azimuth)
sind_surface_tilt = sind(surface_tilt)
cosd_axis_azimuth = cosd(axis_azimuth)
sind_axis_azimuth = sind(axis_azimuth)
sind_axis_tilt = sind(axis_tilt)

# Notation from [1]
# Sun's x, y, z coords
sx = cosd_solar_apparent_elevation * sind(solar_azimuth)
sy = cosd_solar_apparent_elevation * cosd(solar_azimuth)
sz = sind(solar_apparent_elevation)
# Eq. (4); sx', sz' values from sun coordinates projected onto surface
sx_prime = sx * cosd_surface_azimuth - sy * sind_surface_azimuth
sx_prime = sx * cosd_axis_azimuth - sy * sind_axis_azimuth
sz_prime = (
sx * sind_surface_azimuth * sind_surface_tilt
+ sy * sind_surface_tilt * cosd_surface_azimuth
+ sz * cosd(surface_tilt)
sx * sind_axis_azimuth * sind_axis_tilt
+ sy * sind_axis_tilt * cosd_axis_azimuth
+ sz * cosd(axis_tilt)
)
# Eq. (5); angle between sun's beam and surface
theta_T = np.degrees(np.arctan2(sx_prime, sz_prime))
Expand Down
0