-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Deprecate sky_diffuse_passias and amend plot_passias_diffuse_shading.py gallery example
#2589
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
kdebrab
wants to merge
1
commit into
pvlib:main
Choose a base branch
from
kdebrab:amend-sky_diffuse_passias-and-plot_passias_diffuse_shading
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 |
|---|---|---|
|
|
@@ -20,15 +20,21 @@ | |
| # :py:func:`pvlib.shading.masking_angle_passias` and | ||
| # :py:func:`pvlib.shading.sky_diffuse_passias`. | ||
| # | ||
| # However, the pvlib-python authors believe that this approach is incorrect. | ||
| # A correction is suggested and compared with the diffuse shading as obtained | ||
| # with the view factor model. | ||
| # | ||
| # References | ||
| # ---------- | ||
| # .. [1] D. Passias and B. Källbäck, "Shading effects in rows of solar cell | ||
| # panels", Solar Cells, Volume 11, Pages 281-291. 1984. | ||
| # DOI: 10.1016/0379-6787(84)90017-6 | ||
|
|
||
| from pvlib import shading, irradiance | ||
| import matplotlib.pyplot as plt | ||
| import numpy as np | ||
| from cycler import cycler | ||
|
|
||
| from pvlib import bifacial, shading, irradiance | ||
|
|
||
| # %% | ||
| # First we'll recreate Figure 4, showing how the average masking angle varies | ||
|
|
@@ -43,7 +49,7 @@ | |
|
|
||
| plt.figure() | ||
| for k in [1, 1.5, 2, 2.5, 3, 4, 5, 7, 10]: | ||
| gcr = 1/k | ||
| gcr = 1 / k | ||
| psi = shading.masking_angle_passias(surface_tilt, gcr) | ||
| plt.plot(surface_tilt, psi, label=f'k={k}') | ||
|
|
||
|
|
@@ -60,17 +66,18 @@ | |
| # diffuse plane of array irradiance (after accounting for shading) to diffuse | ||
| # horizontal irradiance. This means that the deviation from 100% is due to the | ||
| # combination of self-shading and the fact that being at a tilt blocks off | ||
| # the portion of the sky behind the row. The first effect is modeled with | ||
| # the portion of the sky behind the row. Following the approach detailed in | ||
| # [1]_, the first effect would be modeled with | ||
| # :py:func:`pvlib.shading.sky_diffuse_passias` and the second with | ||
| # :py:func:`pvlib.irradiance.isotropic`. | ||
|
|
||
| plt.figure() | ||
| for k in [1, 1.5, 2, 10]: | ||
| gcr = 1/k | ||
| gcr = 1 / k | ||
| psi = shading.masking_angle_passias(surface_tilt, gcr) | ||
| shading_loss = shading.sky_diffuse_passias(psi) | ||
| transposition_ratio = irradiance.isotropic(surface_tilt, dhi=1.0) | ||
| relative_diffuse = transposition_ratio * (1-shading_loss) * 100 # % | ||
| relative_diffuse = transposition_ratio * (1 - shading_loss) * 100 # % | ||
| plt.plot(surface_tilt, relative_diffuse, label=f'k={k}') | ||
|
|
||
| plt.xlabel('Inclination angle [degrees]') | ||
|
|
@@ -82,3 +89,37 @@ | |
| # %% | ||
| # As ``k`` decreases, GCR increases, so self-shading loss increases and | ||
| # collected diffuse irradiance decreases. | ||
| # | ||
| # However, the pvlib-python authors believe that this approach is incorrect. | ||
|
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. What's the source of this and the other comments below? Was this discussed in an issue somewhere?
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. |
||
| # | ||
| # Instead, the combination of inter-row shading from the previous row and the | ||
| # surface tilt blocking the portion of the sky behind the row is obtained by | ||
| # applying :py:func:`pvlib.shading.sky_diffuse_passias` on the sum of the | ||
| # masking and surface tilt angles (see dashed curves in below figure). The | ||
| # difference with the above approach is marginal for a ground coverage ratio | ||
| # of 10%, but becomes very significant for high ground coverage ratios. | ||
| # | ||
| # Alternatively, one can also use :py:func:`bifacial.utils.vf_row_sky_2d_integ` | ||
| # (see dotted curve in below figure), with very similar results except for the | ||
| # highest ground coverage ratio. It is believed that the deviation is a result | ||
| # of an approximation in :py:func:`pvlib.shading.masking_angle_passias` and | ||
| # that :py:func:`bifacial.utils.vf_row_sky_2d_integ` provides the most accurate | ||
| # result. | ||
|
|
||
| color_cycler = cycler('color', ['blue', 'orange', 'green', 'red']) | ||
| linestyle_cycler = cycler('linestyle', ['--', ':']) | ||
| plt.rc('axes', prop_cycle=color_cycler * linestyle_cycler) | ||
| plt.figure() | ||
| for k in [1, 1.5, 2, 10]: | ||
| gcr = 1 / k | ||
| psi = shading.masking_angle_passias(surface_tilt, gcr) | ||
| vf1 = (1 - shading.sky_diffuse_passias(surface_tilt + psi)) * 100 # % | ||
| vf2 = bifacial.utils.vf_row_sky_2d_integ(surface_tilt, gcr) * 100 # % | ||
| plt.plot(surface_tilt, vf1, label=f'k={k} passias corrected') | ||
| plt.plot(surface_tilt, vf2, label=f'k={k} vf_row_sky_2d_integ') | ||
|
|
||
| plt.xlabel('Inclination angle [degrees]') | ||
| plt.ylabel('Relative diffuse irradiance [%]') | ||
| plt.ylim(0, 105) | ||
| 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
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.
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.
Same comment here as my other comment https://github.com/pvlib/pvlib-python/pull/2589/files#r2590549604