-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add diffuse IAM integration and gallery example #984
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 all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7cbdd04
create marion_integrate function
kandersolar 53ce1e2
add tests
kandersolar 2a4497a
Update api.rst
kandersolar 1bc92fc
add gallery example
kandersolar ef96c0d
whatsnew
kandersolar 68d4ad1
add marion_diffuse, update example+tests
kandersolar 8c80c82
change subtitle in example
kandersolar 011ba9f
add zenith bounds to docstrings
kandersolar a9b2893
Merge branch 'master' into iam_marion
kandersolar 448a376
changes from review
kandersolar 873322b
Merge branch 'iam_marion' of https://github.com/kanderso-nrel/pvlib-p…
kandersolar da66685
fix IAM definition
kandersolar 5738185
improve azimuth comment; store cosaoi for later
kandersolar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
""" | ||
Diffuse IAM Calculation | ||
======================= | ||
|
||
Integrating an IAM model across angles to determine the overall reflection | ||
loss for diffuse irradiance. | ||
""" | ||
|
||
# %% | ||
# The fraction of light reflected from the front of a module depends on the | ||
# angle of incidence (AOI) of the light compared to the panel surface. The | ||
# greater the AOI, the larger the reflected fraction is. The incident angle | ||
# modifier (IAM) is defined as the ratio of light transmitted at the given | ||
# AOI to transmitted light at normal incidence. | ||
# Several models exist to calculate the IAM for a given incidence | ||
# angle (e.g. :py:func:`pvlib.iam.ashrae`, :py:func:`pvlib.iam.martin_ruiz`, | ||
# :py:func:`pvlib.iam.sapm`, :py:func:`pvlib.iam.physical`). | ||
# However, evaluating the IAM for diffuse light is | ||
# not as straightforward because it comes from all directions and therefore | ||
# has a range of angles of incidence. Here we show how to integrate the effect | ||
# of AOI reflection across this AOI range using the process described in [1]_. | ||
# In particular, we will recreate Figures 3, 4, and 5 in that paper. | ||
# | ||
# References | ||
# ---------- | ||
# .. [1] B. Marion "Numerical method for angle-of-incidence correction | ||
# factors for diffuse radiation incident photovoltaic modules", | ||
# Solar Energy, Volume 147, Pages 344-348. 2017. | ||
# DOI: 10.1016/j.solener.2017.03.027 | ||
# | ||
# .. [2] Duffie, John A. & Beckman, William A. (2013). Solar Engineering | ||
# of Thermal Processes. DOI: 10.1002/9781118671603 | ||
|
||
|
||
from pvlib.iam import marion_diffuse, physical | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
|
||
|
||
# %% | ||
# IAM Model | ||
# --------- | ||
# | ||
# The IAM model used to generate the figures in [1]_ uses Snell's, Fresnel's, | ||
# and Beer's laws to determine the fraction of light transmitted through the | ||
# air-glass interface as a function of AOI. | ||
# The function :py:func:`pvlib.iam.physical` implements this model, except it | ||
# also includes an exponential term to model attenuation in the glazing layer. | ||
# To be faithful to Marion's implementation, we will disable this extinction | ||
# term by setting the attenuation coefficient ``K`` parameter to zero. | ||
# For more details on this IAM model, see [2]_. | ||
# | ||
# Marion generated diffuse irradiance modifiers for two cases: a standard | ||
# uncoated glass with index of refraction n=1.526 and a glass with | ||
# anti-reflective (AR) coating with n=1.3. | ||
# Comparing the IAM model across AOI recreates Figure 3 in [1]_: | ||
|
||
aoi = np.arange(0, 91) | ||
iam_no_coating = physical(aoi, n=1.526, K=0) | ||
iam_ar_coating = physical(aoi, n=1.3, K=0) | ||
|
||
plt.plot(aoi, iam_ar_coating, c='b', label='$F_b$, AR coated, n=1.3') | ||
plt.plot(aoi, iam_no_coating, c='r', label='$F_b$, uncoated, n=1.526') | ||
plt.xlabel(r'Angle-of-Incidence, AOI $(\degree)$') | ||
plt.ylabel('Diffuse Incidence Angle Modifier') | ||
plt.legend() | ||
plt.ylim([0, 1.2]) | ||
plt.grid() | ||
|
||
# %% | ||
# Diffuse sky, ground, and horizon IAM | ||
# ------------------------------------ | ||
# | ||
# Now that we have an AOI model, we use :py:func:`pvlib.iam.marion_diffuse` | ||
# to integrate it across solid angle and determine diffuse irradiance IAM. | ||
# Marion defines three types of diffuse irradiance: | ||
# sky, horizon, and ground-reflected. The diffuse IAM value is evaluated | ||
# independently for each type. | ||
|
||
tilts = np.arange(0, 91, 2.5) | ||
|
||
# marion_diffuse calculates all three IAM values (sky, horizon, ground) | ||
iam_no_coating = marion_diffuse('physical', tilts, n=1.526, K=0) | ||
iam_ar_coating = marion_diffuse('physical', tilts, n=1.3, K=0) | ||
|
||
# %% | ||
# First we recreate Figure 4 in [1]_, showing the dependence of the sky diffuse | ||
# incidence angle modifier on module tilt. | ||
|
||
plt.plot(tilts, iam_ar_coating['sky'], c='b', marker='^', | ||
label='$F_{sky}$, AR coated, n=1.3') | ||
plt.plot(tilts, iam_no_coating['sky'], c='r', marker='x', | ||
label='$F_{sky}$, uncoated, n=1.526') | ||
plt.ylim([0.9, 1.0]) | ||
plt.xlabel(r'PV Module Tilt, $\beta (\degree)$') | ||
plt.ylabel('Diffuse Incidence Angle Modifier') | ||
plt.grid() | ||
plt.legend() | ||
plt.show() | ||
|
||
# %% | ||
# Now we recreate Figure 5 in [1]_, showing the dependence of the diffuse iam | ||
# values for horizon and ground diffuse irradiance on module tilt. Note that | ||
# :py:func:`pvlib.iam.marion_diffuse` defaults to using 1800 points for the | ||
# horizon case (instead of 180 like the others) to match [1]_. | ||
|
||
plt.plot(tilts, iam_ar_coating['horizon'], c='b', marker='^', | ||
label='$F_{hor}$, AR coated, n=1.3') | ||
plt.plot(tilts, iam_no_coating['horizon'], c='r', marker='x', | ||
label='$F_{hor}$, uncoated, n=1.526') | ||
plt.plot(tilts, iam_ar_coating['ground'], c='b', marker='s', | ||
label='$F_{grd}$, AR coated, n=1.3') | ||
plt.plot(tilts, iam_no_coating['ground'], c='r', marker='+', | ||
label='$F_{grd}$, uncoated, n=1.526') | ||
plt.xlabel(r'PV Module Tilt, $\beta (\degree)$') | ||
plt.ylabel('Diffuse Incidence Angle Modifier') | ||
plt.grid() | ||
plt.legend() | ||
plt.show() |
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.