- Notifications
You must be signed in to change notification settings - Fork 1.1k
Add polo-smm #2491
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
base: main
Are you sure you want to change the base?
Add polo-smm #2491
Conversation
Add the polo spectral model for BIPV facades
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.
@jesuspolo Thanks for opening your first PR!
I've made some formatting changes, to make sure that the code adheres to the standard flake8 conventions. If you go to the "File changed" tab of this PR, then you can click "Add suggestion to batch" one by one and then commit all of them at once.
Co-authored-by: Adam R. Jensen <39184289+AdamRJensen@users.noreply.github.com>
| @jesuspolo As you can see, the Python Flake8 linter action (shown at the bottom of this PR) failed, due to some formatting not adhering to the Flake8 standard (I guess I didn't manage to spot all of them). If you click the action you can see what still needs to be fixed. Whenever you make changes online and you switch to working on GitHub Desktop, you need to remember to click the "Fetch origin" button to make sure you have the latest changes locally. |
| Hi Adam, I don't know how to solve the problems, I've seen they are about line too long and spaces, but I don't know how to edit the code and solve (sorry for my few capabilities) |
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.
Nice PR @jesuspolo !
There are a bunch of tasks to fulfil so this new feature becomes available to users (most of them are in the PR body):
- Reference it in
docs\sphinx\source\reference\effects_on_pv_system_output\spectrum.rst(so it appears in the documentation, once done, we will be able to review the built docs that appear down below) - Add a whatsnew entry in
docs\sphinx\source\whatsnew - Add tests - the better the exhaustive and the most edge-cases they check
Add test of use of spectral_factor_polo fuction (pull pvlib#2491)
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.
Thank you for this contribution @jesuspolo
I just made a couple of small suggestions for changes to the docstring: rephrasing the summary line and linking the parameter terms to their respective definition on the nomenclature page.
You might already be working on this anyway, but I wanted to add that besides the test you already wrote, it would be good to add tests for edge cases like Echedey suggested. For example, how the function handles inputs such as NaN and 0, or how it handles inputs of different data types such as series or dataframe. I'm happy to help write and/or review such tests if you need, just ask.
pvlib/spectrum/mismatch.py Outdated
| * ``'monosi'`` - anonymous sc-si module. | ||
| * ``'cigs'`` - anonymous copper indium gallium selenide module. | ||
| * ``'asi'`` - anonymous amorphous silicon module. | ||
| albedo |
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.
I was more wondering if the code allows for albedo being passed in as a time series?
+1 to making this possible if not already
| @jesuspolo I'm wondering about your current status with this PR. I see that some of the required tasks I reminded in this comment haven't been fulfilled. If you want, you can contact me at echedey.luis.alvarez (at) upm . es for support in Spanish. |
Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
| @jesuspolo I cleaned up a few things and implemented the suggested changes above (they are now shown as resolved). First, could you comment on whether the albedo could be made a time series, such that the albedo could be changing throughout the year? Second, test functions need to be added here. Tests are functions that tests that specific parts of the code works as expected and don't suddenly break when we add some other code. I suggest that you look at the test for the existing "spectral_factor_" functions for inspiration. As always, feel free to reach out here or via email. |
| Albedo, as occurs with AOD, PW, airmass can input as numpy array . Thus the function allow to compute changes in albedo along the time, as well as chages in aod or in precipitable water |
| am_aoi = pvlib.atmosphere.get_relative_airmass(aoi) | ||
| pressure = pvlib.atmosphere.alt2pres(altitude) | ||
| am90 = pvlib.atmosphere.get_absolute_airmass(am_aoi, pressure) | ||
| Ram = am90 / airmass_absolute |
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.
| am_aoi = pvlib.atmosphere.get_relative_airmass(aoi) | |
| pressure = pvlib.atmosphere.alt2pres(altitude) | |
| am90 = pvlib.atmosphere.get_absolute_airmass(am_aoi, pressure) | |
| Ram = am90 / airmass_absolute | |
| f_aoi_rel= pvlib.atmosphere.get_relative_airmass(aoi, model='kastenyoung1989') | |
| pressure = pvlib.atmosphere.alt2pres(altitude) | |
| f_aoi = pvlib.atmosphere.get_absolute_airmass(f_aoi_rel, pressure) | |
| Ram = f_aoi / airmass_absolute |
I think it is best to stick as closely as possible to the terminology of the paper. It can be confusing that the airmass mode equation is used to calculate a non-airmass quantity.
| altitude: numeric | ||
| altitude over sea level. [m] | ||
| module_type : str, optional | ||
| One of the following PV technology strings from [1]_: |
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.
Are the SR curves used to develop this model open data?
| aod500 : numeric | ||
| atmospheric aerosol optical depth at 500 nm. [unitless] | ||
| aoi : numeric | ||
| Angle of incidence on the vertical surface. See :term:`aoi`. |
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.
In the paper I read:
"...being the angle of incidence corresponding to 90° of tilt angle and the surface azimuth."
Does that really mean the same as this comment in the code?
| if module_type is not None and coefficients is not None: | ||
| raise ValueError('Only one of `module_type` and `coefficients` should ' | ||
| 'be provided') | ||
| am_aoi = pvlib.atmosphere.get_relative_airmass(aoi) |
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.
This will produce a nan if aoi > 90.
Add the polo spectral model for BIPV facades
docs/sphinx/source/referencefor API changes.docs/sphinx/source/whatsnewfor 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`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.Adding the spectral model for estimating spectral mismatch for BIPV in facades according to ref: Polo, J., Sanz-saiz, C., 2025. Development of spectral mismatch models for BIPV applications in building façades Abbreviations : Renew. Energy 245, 122820. https://doi.org/10.1016/j.renene.2025.122820