Skip to content

Calculating horizon profiles and associated shading losses #758

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

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
691d353
first pass at horizon code in pvlib
JPalakapillyKWH Jul 19, 2019
99426ba
added most of horizon shading code
JPalakapillyKWH Jul 23, 2019
39302d6
wrapped up most code and added docstrings to irradiance
JPalakapillyKWH Jul 25, 2019
2daa5c6
added more documentation
JPalakapillyKWH Jul 29, 2019
6cb7399
reverted setup
JPalakapillyKWH Jul 29, 2019
df724e5
linted
JPalakapillyKWH Jul 29, 2019
808af03
more lints + moved import of gmaps
JPalakapillyKWH Jul 29, 2019
7573763
added scipy to setup.py and fixed bug in modelchain
JPalakapillyKWH Jul 31, 2019
3421899
moved some horizon functions to tools and fixed naming. Also wrote 2 …
JPalakapillyKWH Aug 1, 2019
b600e16
added test_horizon.py and code restructuring
JPalakapillyKWH Aug 2, 2019
b0c9193
moved horizon adjustmen to isotropic. Fixed some tests
JPalakapillyKWH Aug 2, 2019
e6beb32
removed gmaps from horizon. Deleted remnants of horizon adjusment model
JPalakapillyKWH Aug 2, 2019
10baccd
major code restructuring. much more numpy friendly now. still need to…
JPalakapillyKWH Aug 6, 2019
345eaa0
updated docstrings
JPalakapillyKWH Aug 6, 2019
5405d75
docstring changes
JPalakapillyKWH Aug 7, 2019
cc481c7
made some changes to modelchain and location due to restructuring of …
JPalakapillyKWH Aug 7, 2019
15e59eb
added one more test to modelchain
JPalakapillyKWH Aug 7, 2019
33c0bb8
threw code and some docs into horizon.rst
JPalakapillyKWH Aug 7, 2019
18ccd1a
reverted irradiance, location and modelchain (and tests) to master
JPalakapillyKWH Aug 7, 2019
d1119ab
changed dip angles to elevation angles
JPalakapillyKWH Aug 7, 2019
57c2035
removed horizon.rst for now
JPalakapillyKWH Aug 7, 2019
00017e2
added DNI correction to horizon.py
JPalakapillyKWH Aug 8, 2019
a87b797
added a test case to get 100% of diff hit
JPalakapillyKWH Aug 8, 2019
aeb5f95
minor test fix
JPalakapillyKWH Aug 8, 2019
b022f9e
docstring changes and improvement to filter_points
JPalakapillyKWH Aug 9, 2019
d07e66f
added tests for functions added in tools.py. Some docstring changes a…
JPalakapillyKWH Aug 12, 2019
2411520
minor improvements and docstring changes
JPalakapillyKWH Aug 13, 2019
210fd1c
docstring changes
JPalakapillyKWH Aug 13, 2019
a630acc
reference update
JPalakapillyKWH Aug 13, 2019
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
15 changes: 10 additions & 5 deletions pvlib/horizon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The ``horizon`` module contains functions for horizon profile modeling.
There are various geometric utilities that are useful in horizon calculations.
"""
from __future__ import division

import itertools

Expand Down Expand Up @@ -65,7 +64,7 @@ def elevation_and_azimuth(pt1, pt2):
horizontal has a positive elevation angle. Also computes the azimuth
defined as degrees East of North of the bearing from pt1 to pt2.
This uses the Haversine formula.
The method used to calculate the elevation angle is discussed in [1].
The trigonometry used to calculate the elevation angle is described in [1].

Parameters
----------
Expand Down Expand Up @@ -100,6 +99,9 @@ def elevation_and_azimuth(pt1, pt2):
[36, 35, 231],
[36, 35, 21]])
bearing, elev_angles = elevation_and_azimuth(site_loc, target_locs)


[1] https://aty.sdsu.edu/explain/atmos_refr/dip.html
'''
# Equatorial Radius of the Earth (ellipsoid model) in meters
a = 6378137.0
Expand Down Expand Up @@ -612,11 +614,14 @@ def calculate_dtf(horizon_azimuths, horizon_angles,
integral is the cosine of the angle between the incoming radiation and the
vector normal to the surface. The method calculates a sum of integrations
from the "peak" of the sky dome down to the elevation angle of the horizon.
Copy link
Member

Choose a reason for hiding this comment

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

Could you mention the relevant section or equation(s) in [1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean [2]?

Copy link
Member

Choose a reason for hiding this comment

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

I only see one reference...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my bad. latest changes have the new reference. Old one was wrong.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I read this paper too. Which equation(s) are you implementing?

A similar method is used in section II of [1] although it is looking at
both ground and sky diffuse irradiation.

[1] Goss et al. (2014) Solar Energy 110, 410-419

[2] Wright D. (2019) IEEE Journal of Photovoltaics 9(2), 391-396
Copy link
Member

Choose a reason for hiding this comment

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

Looks interesting. Could you send me a copy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sent an email

"""
assert(horizon_azimuths.shape[0] == horizon_angles.shape[0])
if horizon_azimuths.shape[0] != horizon_angles.shape[0]:
raise ValueError('azimuths and elevation_angles must be of the same'
'length.')
tilt_rad = np.radians(surface_tilt)
plane_az_rad = np.radians(surface_azimuth)
a = np.sin(tilt_rad) * np.cos(plane_az_rad)
Expand Down