Skip to content
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

Agrivoltaics - PAR diffuse fraction model #2048

Merged
merged 37 commits into from
Jun 20, 2024

Conversation

echedey-ls
Copy link
Contributor

@echedey-ls echedey-ls commented May 12, 2024

  • Closes Photosynthetically active radiation decomposition model #2047
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries in docs/sphinx/source/reference for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

Adds the model described in #2047.

Current implementation

I'm a bit hesitant about the tests here. I haven't found any straightforward way to make the tests from the papers. They check the mathematical integrity of the implementation, if that's a thing.

Docs links

Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

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

Just an early stage review.

pvlib/par.py Outdated Show resolved Hide resolved
pvlib/par.py Outdated Show resolved Hide resolved
pvlib/par.py Outdated Show resolved Hide resolved
pvlib/tests/test_par.py Outdated Show resolved Hide resolved
@AdamRJensen AdamRJensen added the GSoC Contributions related to Google Summer of Code. label May 24, 2024
@echedey-ls echedey-ls marked this pull request as ready for review May 24, 2024 11:36
@echedey-ls
Copy link
Contributor Author

Moved to irradiance.py!! (I'm a request away to do a poll via reaction emojis 😅 😉 )

Everybody, feel free to review 👀 .

docs/sphinx/source/reference/irradiance/components.rst Outdated Show resolved Hide resolved
pvlib/irradiance.py Outdated Show resolved Hide resolved
@echedey-ls
Copy link
Contributor Author

Again, thx for the review

Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

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

The reference mentions

where the subscript d points to daily totals

Is it correct that the expression is for daily values? If so, that needs to be denoted in the ocstring.

pvlib/irradiance.py Outdated Show resolved Hide resolved
pvlib/irradiance.py Outdated Show resolved Hide resolved
pvlib/irradiance.py Outdated Show resolved Hide resolved
pvlib/irradiance.py Outdated Show resolved Hide resolved
Copy link
Member

@AdamRJensen AdamRJensen left a comment

Choose a reason for hiding this comment

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

Great job! Just a few minor comments

# calculated using the Spitter's relationship [1]_ implemented in
# :py:func:`~pvlib.irradiance.diffuse_par_spitters`.
# This model requires the solar zenith angle and the fraction of the broadband
# radiation that is diffuse as inputs.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# radiation that is diffuse as inputs.
# irradiance that is diffuse as inputs.

Copy link
Member

Choose a reason for hiding this comment

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

To (perhaps) head off a discussion of whether "radiation" or "irradiance" should be used here: radiation is usually used when referring to the source, and irradiance (or irradiation) when referring to the receiver. So the sun emits radiation, and a tilted plane on the earth's surface receives solar irradiation. Either perspective seems OK to me in the context of this PR. But mixing PAR (..."radiation") with "irradiance" may be confusing to some.

Comment on lines 76 to 77
# The total PAR can be approximated as 0.50 times the broadband horizontal
# irradiance (GHI) for solar elevation higher that 10°.
Copy link
Member

Choose a reason for hiding this comment

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

Is PAR simply 0 at solar elevation angles less than 10 degrees? Seems odd

@echedey-ls echedey-ls marked this pull request as draft June 19, 2024 08:01
@echedey-ls
Copy link
Contributor Author

Is it correct that the expression is for daily values? If so, that needs to be denoted in the docstring.

@AdamRJensen you are completely right. I remember reading that but not in the original paper, so I thought the integration was done later. I didn't read the solar elevation was averaged neither :(

I will update the docs and the example. Should I call the irradiance integral radiation or insolation? The paper uses the former, but I've seen the latter in pvpmc.sandia.gov

Btw, I don't know which day the release will be done, so feel free to exclude this PR from the merge list.

Co-Authored-By: Adam R. Jensen <[email protected]>
@cwhanse
Copy link
Member

cwhanse commented Jun 19, 2024

Is it correct that the expression is for daily values? If so, that needs to be denoted in the docstring.

I missed that as well. If the relationship is only for daily values, that fact should be stated prominently.

@AdamRJensen
Copy link
Member

AdamRJensen commented Jun 19, 2024

Is it correct that the expression is for daily values? If so, that needs to be denoted in the docstring.

I missed that as well. If the relationship is only for daily values, that fact should be stated prominently.

Upon skimming it briefly it seems to be daily values. @echedey-ls do you know what units they use, e.g., W/m2 vs Wh/m2?

The corrections happening in the equation account for differences in overcast vs clear sky days, which makes me doubt that's its for daily values (though it could just be accounting for whether the day is mostly cloudy or clear). But then why is PAR less than 10 degrees set to 0? Is that if the daily average solar elevation is less than 10? I think this probably deserves a more careful read

@echedey-ls
Copy link
Contributor Author

Upon skimming it briefly it seems to be daily values. @echedey-ls do you know what units they use, e.g., W/m2 vs Wh/m2?

image
From page 11

But then why is PAR less than 10 degrees set to 0? Is that if the daily average solar elevation is less than 10?

I think you are right. I set it to zero because nothing came up to my head about how to handle and interpret that statement in the paper. I did that thinking the solar elevation was an instantaneous value, not the average. In the upcoming example I will fix that. And possibly include a warning in the function too.

@echedey-ls echedey-ls marked this pull request as ready for review June 20, 2024 12:56
Co-Authored-By: Adam R. Jensen <[email protected]>
@AdamRJensen
Copy link
Member

@cwhanse I'm happy with the state of this PR. If you also approve, I think this could be merged in time for the 0.11.0 release.

Copy link
Member

@cwhanse cwhanse left a comment

Choose a reason for hiding this comment

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

One more small edit and LGTM also

pvlib/irradiance.py Outdated Show resolved Hide resolved
Co-authored-by: Cliff Hansen <[email protected]>
@AdamRJensen AdamRJensen merged commit 229a187 into pvlib:main Jun 20, 2024
30 checks passed
@AdamRJensen
Copy link
Member

Thank you @echedey-ls!

Great work and go GSoC 🥳

@echedey-ls echedey-ls deleted the par-diffuse-fraction-of-global-par branch June 20, 2024 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement GSoC Contributions related to Google Summer of Code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Photosynthetically active radiation decomposition model
4 participants