-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NREL non-uniform irradiance mismatch loss for bifacial modules #2046
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 22 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
9c68605
Preliminar implementation, tests, docs and gallery example
echedey-ls 7c17712
Merge branch 'main' into nrel-mismatch-loss
echedey-ls 23320db
Update versionadded
echedey-ls 47fa80d
Add example
echedey-ls 84346d2
docstring update
echedey-ls bdb9955
Update v0.11.0.rst
echedey-ls 914d009
who would have guessed it's always the linter?
echedey-ls 29f4c66
Update plot_irradiance_nonuniformity_loss.py
echedey-ls 03011d3
equation fixes
echedey-ls de1744a
RMAD properties application typo
echedey-ls 7f27c9f
does this fix the link?
echedey-ls 2cdc95f
yet another link
echedey-ls 0698839
These links will never work, I suppose
echedey-ls 7f27f1c
Move some "Notes" equations to example and rearrange things there
echedey-ls 58c05bd
give this equation it's space
echedey-ls b973959
eq rendering fixes?
echedey-ls 448b647
maths are not mathing today
echedey-ls 5768473
???
echedey-ls b1a7e4a
??? x2
echedey-ls d1b476d
??? x3
echedey-ls d037314
i feel stupid for this
echedey-ls 4ec952b
Change preprint ref to published one
echedey-ls b0cadb5
Published paper coeffs
echedey-ls 9f51b68
Lots of improvements
echedey-ls 67d3737
Linter - also missing Eq (7)
echedey-ls 10ac204
Test polynomial input
echedey-ls 9290f41
Math
echedey-ls c7b94a0
Test exception
echedey-ls 3599991
Update pvsystem.py
echedey-ls c965225
Update plot_irradiance_nonuniformity_loss.py
echedey-ls 0c15443
Add fill factor ratio
echedey-ls d141189
ª
echedey-ls 8a19a4d
Trying new things
echedey-ls c32f78a
Revert "Trying new things"
echedey-ls 5f69b6d
Update pvsystem.py
echedey-ls 4c354ea
:(
echedey-ls a2de166
:((
echedey-ls b572f45
I hope we dont miss that reference
echedey-ls 1b0565b
Update pvsystem.py
echedey-ls 87f46f0
Remove second section of the example
echedey-ls ae775ec
Minor text upgrade
echedey-ls 4c75534
Merge branch 'main' into nrel-mismatch-loss
echedey-ls 1906e20
Update pvsystem.py
echedey-ls f5863ce
Port to namespace `pvlib.bifacial`
echedey-ls a7d3f7e
Rename to ``power_mismatch_deline``, document in ``bifacial.rst``
echedey-ls 84f702f
fillfactor only for predefined models
echedey-ls 3ad18a6
Docstring rewording
echedey-ls b6c6fb2
Linter
echedey-ls 18a397f
More docs rewording
echedey-ls 1d7d86c
Merge branch 'main' into nrel-mismatch-loss
echedey-ls 8bae370
Apply suggestions from Dax
echedey-ls 75ae58b
Unneded image Dominguez_et_al_PVSC2023.png
echedey-ls b106ff8
Rename file
echedey-ls 4c78987
Fix equations
echedey-ls 56c7d2e
yup it didnt save
echedey-ls d225a6d
lintaaaaaaarrrr
echedey-ls 36f3be0
Eq 7 numbering
echedey-ls 0c99269
Revert unintended changes
echedey-ls a46245a
Adam code review
echedey-ls a4a32e0
Links?
echedey-ls 88273ba
Referencing equations manually
echedey-ls f096a0a
Polynomial links
echedey-ls 5945b74
Dont abuse math mode
echedey-ls adbcbeb
Update loss_models.py
echedey-ls 6f5c69f
I forgot
echedey-ls 770b4a5
Adam Code Review
echedey-ls 329312a
Merge branch 'main' into nrel-mismatch-loss
echedey-ls 9d0411b
Merge branch 'main' into nrel-mismatch-loss
echedey-ls a9d507f
whatsnews
echedey-ls 243de31
Update v0.11.0.rst
echedey-ls 204f8b7
Weird that some tests pass and others dont
echedey-ls a88cb4c
Update loss_models.py
echedey-ls 0136b3a
document
echedey-ls c6ca308
Update loss_models.py
echedey-ls adad0c1
Kevin's review (I)
echedey-ls 6fafcb4
Kevin's review (II)
echedey-ls 436b0e2
Kevin's review (III)
echedey-ls 7d91db6
Update v0.11.1.rst
echedey-ls b1b51bd
minor changes
echedey-ls 3991800
Forgot to update tests
echedey-ls aeaabb4
Accordingly modify model, IO, docs to unitless model
echedey-ls 9289412
Update loss_models.py
echedey-ls f025133
Update loss_models.py
echedey-ls 69a5acf
Apply suggestions from code review
echedey-ls 945d61a
Code review from Cliff
echedey-ls cecc337
Rendering issues, code review from Kevin
echedey-ls 289dbeb
Little missing newline
echedey-ls 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
265 changes: 265 additions & 0 deletions
265
docs/examples/bifacial/plot_irradiance_nonuniformity_loss.py
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,265 @@ | ||
""" | ||
Plot Irradiance Non-uniformity Loss | ||
=================================== | ||
|
||
Calculate the incident irradiance lost to non-uniformity in a bifacial PV array | ||
""" | ||
|
||
# %% | ||
# The incident irradiance on the backside of a bifacial PV module is | ||
# not uniform due to neighboring rows, the ground albedo and site conditions. | ||
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Cells with different irradiance levels produce less power that the sum of | ||
# the power produced by each cell individually. This is known as irradiance | ||
# non-uniformity loss. | ||
# | ||
# This example demonstrates how to model the irradiance non-uniformity loss | ||
# due to different global irradiance levels on a bifacial PV module through | ||
# two different approaches: | ||
# | ||
# - Given the irradiance levels of each cell in an instant, | ||
# in the first section. | ||
# - Modelling the irradiance non-uniformity RMAD through the day thanks to a | ||
# mock-up horizontal axis tracker system, in the second section. | ||
# See [2]_ and [3]_ for more information. | ||
# | ||
# The function :py:func:`pvlib.pvsystem.nonuniform_irradiance_loss` will be | ||
# used to transform the Relative Mean Absolute Deviation (RMAD) of the | ||
# irradiance into a power loss percentage. Down below you will find a | ||
# numpy-based implementation of the RMAD function. | ||
# | ||
# References | ||
# ---------- | ||
# .. [1] C. Deline, S. Ayala Pelaez, S. MacAlpine, and C. Olalla, 'Estimating | ||
# and parameterizing mismatch power loss in bifacial photovoltaic | ||
# systems', Progress in Photovoltaics: Research and Applications, vol. 28, | ||
# no. 7, pp. 691-703, 2020, :doi:`10.1002/pip.3259`. | ||
# .. [2] C. Domínguez, J. Marcos, S. Ures, S. Askins, and I. Antón, 'A | ||
# Horizontal Single-Axis Tracker Mock-Up to Quickly Assess the Influence | ||
# of Geometrical Factors on Bifacial Energy Gain', in 2023 IEEE 50th | ||
# Photovoltaic Specialists Conference (PVSC), Jun. 2023, pp. 1–3. | ||
# :doi:`10.1109/PVSC48320.2023.10359580`. | ||
# .. [3] C. Domínguez, J. Marcos, S. Ures, S. Askins, I. Antón, A Horizontal | ||
# Single-Axis Tracker Mock-Up to Quickly Assess the Influence of Geometrical | ||
# Factors on Bifacial Energy Gain. Zenodo, 2023. | ||
# :doi:`10.5281/zenodo.11125039`. | ||
# | ||
# .. sectionauthor:: Echedey Luis <echelual (at) gmail.com> | ||
|
||
import numpy as np | ||
import pandas as pd | ||
import scipy.stats | ||
import matplotlib.pyplot as plt | ||
from matplotlib.cm import ScalarMappable | ||
from matplotlib.colors import Normalize | ||
|
||
from pvlib.pvsystem import nonuniform_irradiance_loss | ||
|
||
# %% | ||
# Theoretical and straightforward problem | ||
# --------------------------------------- | ||
# Let's set a fixed irradiance to each cell row of the PV array with the values | ||
# described in Figure 1 (a), [1]_. We will cover this case for educational | ||
# purposes. | ||
# Here we set and plot the global irradiance levels of each cell. | ||
|
||
x = np.arange(6, 0, -1) | ||
y = np.arange(6, 0, -1) | ||
cells_irrad = np.repeat([1059, 976, 967, 986, 1034, 1128], 6).reshape(6, 6) | ||
|
||
color_map = "gray" | ||
color_norm = Normalize(930, 1150) | ||
|
||
fig, ax = plt.subplots() | ||
fig.suptitle("Global Irradiance Levels of Each Cell") | ||
fig.colorbar( | ||
ScalarMappable(cmap=color_map, norm=color_norm), | ||
ax=ax, | ||
orientation="vertical", | ||
label="$[W/m^2]$", | ||
) | ||
ax.set_aspect("equal") | ||
ax.pcolormesh( | ||
x, | ||
y, | ||
cells_irrad, | ||
shading="nearest", | ||
edgecolors="black", | ||
cmap=color_map, | ||
norm=color_norm, | ||
) | ||
|
||
# %% | ||
# Relative Mean Absolute Deviation | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# Calculate the Relative Mean Absolute Deviation (RMAD) of the cells' | ||
# irradiance with the following function, Eq. (4) of [1]_: | ||
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# | ||
# .. math:: | ||
# | ||
# \Delta \left[ \% \right] = \frac{1}{n^2 \bar{G}_{total}} | ||
# \sum_{i=1}^{n} \sum_{j=1}^{n} \lvert G_{total,i} - G_{total,j} \rvert | ||
# | ||
|
||
|
||
def rmad(data, axis=None): | ||
""" | ||
Relative Mean Absolute Deviation. | ||
https://stackoverflow.com/a/19472336/19371110 | ||
""" | ||
mad = np.mean(np.absolute(data - np.mean(data, axis)), axis) | ||
return mad / np.mean(data, axis) | ||
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
rmad_cells = rmad(cells_irrad) | ||
|
||
# this is the same as a column's RMAD! | ||
print(rmad_cells == rmad(cells_irrad[:, 0])) | ||
|
||
# %% | ||
# Mismatch Loss | ||
# ^^^^^^^^^^^^^ | ||
# Calculate the power loss percentage due to the irradiance non-uniformity | ||
# with the function :py:func:`pvlib.pvsystem.nonuniform_irradiance_loss`. | ||
|
||
mismatch_loss = nonuniform_irradiance_loss(rmad_cells) | ||
|
||
# %% | ||
# Total power incident on the module cells | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# It is the sum of the irradiance of each cell | ||
|
||
total_irrad = np.sum(cells_irrad) | ||
|
||
# %% | ||
# Mismatch-corrected irradiance | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# The power incident on the module cells is multiplied by the mismatch loss | ||
# as follows: | ||
|
||
mismatch_corrected_irrad = total_irrad * (1 - mismatch_loss) | ||
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# %% | ||
# Results | ||
# ^^^^^^^ | ||
|
||
print(f"Total power incident on the module cells: {total_irrad}") | ||
print(f"RMAD of the cells' irradiance: {rmad_cells}") | ||
print(f"Power loss % due to the irradiance non-uniformity: {mismatch_loss}") | ||
print(f"Effective power after mismatch correction: {mismatch_corrected_irrad}") | ||
|
||
# %% | ||
# A practical approach | ||
echedey-ls marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# -------------------- | ||
# In practice, simulating each cell irradiance is computationally expensive, | ||
# and measuring each of the cells irradiance of a real system can also be | ||
# challenging. Nevertheless, a mock-up system can be used to estimate the | ||
# non-uniformity through the day. | ||
# | ||
# Here we will base our calculations on the work of Domínguez et al. [2]_. | ||
# The following image in [3]_ shows the backside irradiance non-uniformity of a | ||
# HSAT mock-up system: | ||
# | ||
# .. figure:: ../../_images/Dominguez_et_al_PVSC2023.png | ||
# :alt: Plot of backside reference cells of an HSAT mock-up and their RMAD. | ||
# :align: center | ||
# | ||
# Blue dots represent the backside irradiance non-uniformity. | ||
# *BE* stands for *backside east*. | ||
|
||
|
||
def hsat_backside_rmad_model_through_day(hour): | ||
"""Model of the blue dots in the image above.""" | ||
# For demonstration purposes only. Model roughly fit to show an example of | ||
# the RMAD variation through the day without including all the data. | ||
# fmt: off | ||
morning_polynom = [6.71787833e-02, -4.50442998e+00, 1.18114757e+02, | ||
-1.51725679e+03, 9.56439547e+03, -2.36835920e+04] | ||
afternoon_polynom = [7.14947943e-01, -6.02541075e+01, 2.02789031e+03, | ||
-3.40677727e+04, 2.85671091e+05, -9.56469320e+05] | ||
# fmt: on | ||
day_rmad = np.where( | ||
hour < 14.75, | ||
np.polyval(morning_polynom, hour), | ||
np.polyval(afternoon_polynom, hour), | ||
) | ||
return day_rmad / 100 # RMAD is a percentage | ||
|
||
|
||
# %% | ||
# Calculating Global RMAD from Backside RMAD | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# | ||
# .. note:: | ||
# The global irradiance RMAD is different from the backside irradiance RMAD. | ||
# | ||
# The global irradiance is the sum of the front irradiance and the backside | ||
# irradiance by the bifaciality factor, see equation (2) in [1]_. | ||
# | ||
# .. math:: | ||
# | ||
# G_{total,i} = G_{front,i} + \phi_{Bifi} G_{rear,i} | ||
# | ||
# where :math:`\phi_{Bifi}` is the bifaciality factor. | ||
# | ||
# Here we will model front and backside irradiances with normal distributions | ||
# for simplicity, then calculate the global RMAD and plot the results. | ||
# | ||
# The backside irradiance is the one that presents the most significant | ||
# non-uniformity. The front irradiance is way more uniform, so it will be | ||
# neglected in this example. | ||
# | ||
# Let's calculate the **global RMAD** through the day - it's **different** from | ||
# the backside RMAD since | ||
# | ||
# .. math:: | ||
# | ||
# RMAD(k \cdot X + c) = RMAD(X) \cdot k \frac{k \bar{X}}{k \bar{X} + c} | ||
# = RMAD(X) \cdot k \frac{1}{1 + \frac{c}{k \bar{X}}} | ||
# | ||
# where :math:`X` is a random variable and :math:`k>0, c \neq \bar{X}` are | ||
# constants (`source | ||
# <https://en.wikipedia.org/wiki/Mean_absolute_difference#Properties>`_). | ||
|
||
times = pd.date_range("2023-06-06T09:30", "2023-06-06T18:30", freq="30min") | ||
hours = times.hour + times.minute / 60 | ||
bifaciality = 0.65 | ||
front_irrad = scipy.stats.norm.pdf(hours, loc=12.5, scale=1600) | ||
backside_irrad = scipy.stats.norm.pdf(hours, loc=12.5, scale=180) | ||
|
||
global_irrad = front_irrad + bifaciality * backside_irrad | ||
# See RMAD properties above | ||
# Here we calculate RMAD(global_irrad) | ||
# backside_irrad := X, bifaciality := k, front_irrad := c | ||
backside_rmad = hsat_backside_rmad_model_through_day(hours) | ||
global_rmad = ( | ||
backside_rmad | ||
* bifaciality | ||
/ (1 + front_irrad / backside_irrad / bifaciality) | ||
) | ||
|
||
# Get the mismatch loss | ||
mismatch_loss = nonuniform_irradiance_loss(global_rmad) | ||
|
||
# Plot results | ||
fig, ax1 = plt.subplots() | ||
fig.suptitle("Irradiance RMAD and Mismatch Losses") | ||
|
||
ax1.plot(hours, global_rmad, label="RMAD: global", color="k") | ||
ax1.plot( | ||
hours, backside_rmad, label="RMAD: backside", color="b", linestyle="--" | ||
) | ||
ax1.set_xlabel("Hour of the day") | ||
ax1.set_ylabel("RMAD") | ||
ax1.legend(loc="upper left") | ||
|
||
ax2 = ax1.twinx() | ||
ax2.plot( | ||
hours, mismatch_loss, label="Mismatch loss", color="red", linestyle=":" | ||
) | ||
ax2.grid() | ||
ax2.legend(loc="upper right") | ||
ax2.set_ylabel("Mismatch loss") | ||
|
||
fig.show() | ||
|
||
# %% |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ Loss models | |
|
||
pvsystem.combine_loss_factors | ||
pvsystem.dc_ohms_from_percent | ||
pvsystem.nonuniform_irradiance_loss |
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.