-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
691d353
first pass at horizon code in pvlib
JPalakapillyKWH 99426ba
added most of horizon shading code
JPalakapillyKWH 39302d6
wrapped up most code and added docstrings to irradiance
JPalakapillyKWH 2daa5c6
added more documentation
JPalakapillyKWH 6cb7399
reverted setup
JPalakapillyKWH df724e5
linted
JPalakapillyKWH 808af03
more lints + moved import of gmaps
JPalakapillyKWH 7573763
added scipy to setup.py and fixed bug in modelchain
JPalakapillyKWH 3421899
moved some horizon functions to tools and fixed naming. Also wrote 2 …
JPalakapillyKWH b600e16
added test_horizon.py and code restructuring
JPalakapillyKWH b0c9193
moved horizon adjustmen to isotropic. Fixed some tests
JPalakapillyKWH e6beb32
removed gmaps from horizon. Deleted remnants of horizon adjusment model
JPalakapillyKWH 10baccd
major code restructuring. much more numpy friendly now. still need to…
JPalakapillyKWH 345eaa0
updated docstrings
JPalakapillyKWH 5405d75
docstring changes
JPalakapillyKWH cc481c7
made some changes to modelchain and location due to restructuring of …
JPalakapillyKWH 15e59eb
added one more test to modelchain
JPalakapillyKWH 33c0bb8
threw code and some docs into horizon.rst
JPalakapillyKWH 18ccd1a
reverted irradiance, location and modelchain (and tests) to master
JPalakapillyKWH d1119ab
changed dip angles to elevation angles
JPalakapillyKWH 57c2035
removed horizon.rst for now
JPalakapillyKWH 00017e2
added DNI correction to horizon.py
JPalakapillyKWH a87b797
added a test case to get 100% of diff hit
JPalakapillyKWH aeb5f95
minor test fix
JPalakapillyKWH b022f9e
docstring changes and improvement to filter_points
JPalakapillyKWH d07e66f
added tests for functions added in tools.py. Some docstring changes a…
JPalakapillyKWH 2411520
minor improvements and docstring changes
JPalakapillyKWH 210fd1c
docstring changes
JPalakapillyKWH a630acc
reference update
JPalakapillyKWH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
added DNI correction to horizon.py
- Loading branch information
commit 00017e289ca254023948312ca50a66216d764df0
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
import itertools | ||
|
||
import numpy as np | ||
import warnings | ||
|
||
from scipy.interpolate import RegularGridInterpolator | ||
|
||
from pvlib import tools | ||
|
@@ -594,3 +596,51 @@ def calculate_dtf(horizon_azimuths, horizon_angles, | |
second_term = .5 * c * np.cos(elev)**2 | ||
dtf += 2 * (first_term + second_term) / num_points | ||
return dtf | ||
|
||
|
||
def DNI_horizon_adjustment(horizon_angles, solar_zenith, solar_azimuth): | ||
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
''' | ||
Calculates an adjustment to DNI based on a horizon profile. The adjustment | ||
is a vector of binary values with the same length as the provided | ||
solar position values. Where the sun is below the horizon, the adjustment | ||
vector is 0 and it is 1 elsewhere. The horizon profile must be given as a | ||
vector with 361 values where the ith value corresponds to the ith degree | ||
cwhanse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
of azimuth (0-360). | ||
|
||
|
||
Parameters | ||
---------- | ||
horizon_angles: numeric | ||
Elevation angle values for points that define the horizon profile. The | ||
elevation angle of the horizon is the angle that the horizon makes with | ||
the horizontal. It is given in degrees above the horizontal. The ith | ||
element in this array corresponds to the ith degree of azimuth. | ||
|
||
solar_zenith : numeric | ||
Solar zenith angle. | ||
|
||
solar_azimuth : numeric | ||
Solar azimuth angle. | ||
|
||
Returns | ||
------- | ||
adjustment : numeric | ||
A vector of binary values with the same shape as the inputted solar | ||
position values. 0 when the sun is below the horizon and 1 elsewhere. | ||
''' | ||
adjustment = np.ones(solar_zenith.shape) | ||
|
||
if (horizon_angles.shape[0] != 361): | ||
warnings.warn('For DNI adjustment, horizon_angles needs to contain' | ||
'exactly 361 values (for each degree of azimuth 0-360).' | ||
'Since the provided horizon_angles contains {} values,' | ||
'no adjustment is calculated. A vector of ones is' | ||
'returned.'.format(horizon_angles.shape[0]), | ||
UserWarning) | ||
return adjustment | ||
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. raise an exception instead of returning 1s and a warning. |
||
|
||
rounded_solar_azimuth = np.round(solar_azimuth).astype(int) | ||
horizon_zenith = 90 - horizon_angles[rounded_solar_azimuth] | ||
mask = solar_zenith > horizon_zenith | ||
adjustment[mask] = 0 | ||
return adjustment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uh oh!
There was an error while loading. Please reload this page.