-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Added irradiance_loss_pvsyst function to pvsystem #1000
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
Conversation
…o pvsystem class.
The direction this PR goes is fine. The review will be easier if we can clean up the formatting issues first, LMK if you would like some help with that. I'm fine with the calculations. I'll probably suggest some renaming of the parameters (drop |
I updated the formatting, but I'm still running into some issues there that I'm not sure how to resolve. Some insight on what's required for passing formatting would be greatly appreciated. With respect to the "irradiance_" included in many variable names, I agree that's cumbersome and am happy to pull that. The reason I included it was to differentiate from the electrical loss models that can also be associated with shading, soiling, and snow coverage. If you believe that differentiation is obvious given the context of the function, then it's overly specific. |
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
I attempted to add tests. I'm a little unfamiliar with this system, but I don't think all of the test failures happening are from my addition. If they are, there is clearly something I'm missing and will require assistance. I think it's at a place for detailed review when a @pvlib/maintainer has the time. |
The test warnings and failures are unrelated to this PR. I'll review the PR soon. |
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.
Thanks @btaute I got caught up in other work. This is looking very good.
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
I believe I've incorporated all of your comments @cwhanse. The only one outstanding is the What's New addition. This should be ready for another (maybe final) review. |
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.
Thanks @btaute for the contribution. Some questions for you and Cliff below...
Also needs an entry in https://github.com/pvlib/pvlib-python/blob/master/docs/sphinx/source/api.rst
pvlib/pvsystem.py
Outdated
def irradiance_loss_pvsyst(effective_irradiance, irradiance_shading_loss, | ||
irradiance_snow_loss, irradiance_soiling_loss): |
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.
The function would return the same thing if the user permuted the loss arguments. We could consider *losses
for a more general and extensible approach.
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 like this idea. I believe calling out the losses explicitly helps guide new users, but I think an in-depth tutorial can serve that purpose better while allowing for more flexibility here.
If we make this update, I don't think the function name "irradiance_loss_pvsyst" is apt anymore. The point of the function is that it allows a convenient way to compound any irradiance losses that should be applied to the total POA (not specific to beam, diffuse, or ground POA). Maybe that means it should be called "compound_effective_irradiance_losses?" Maybe "combine_effective_irradiance_losses?"
A future implementation more inline with PVSyst should be a "pvsyst_effective_irradiance" function.
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.
+1 to combine_loss_factors
or similar for a general purpose function, since the PVWatts model does the same calculation on a different set of inputs.
I think it's helpful to also have a function named irradiance_loss_pvsyst
or similar, with arguments that are easily recognized by someone used to using the PVsyst loss model. If we keep a _pvsyst function, it should return effective_irradiance with losses applied, instead of the loss factor.
effective_irradiance_pvsyst
implies that the function also calculates and applies reflection and spectral mismatch modifiers, which is a larger scope that this PR.
# Conflicts: # pvlib/tests/test_pvsystem.py
I'm not sure how to address the Read the Docs build failure. Any advice there would be greatly appreciated. I changed the direction of the Pull Request based on the conversation. It's now a general function for combining losses, which will end up getting called by almost all of the specific system loss functions (i.e. PVSyst loss functions). The math is simple but it also takes into account resampling, which will be beneficial for extrapolating monthly values to hourly values, etc. |
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.
some suggestions for the docstring
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
@btaute it looks to me like this could be merged once the conflicts are resolved. |
@wholmgren I believe those conflicts have been resolved. |
@btaute looks like the merge brought some older unwanted code back into the modules. |
Sorry, I misunderstood the conflicts. Is this better? |
* Add :py:func:`pvlib.shading.sky_diffuse_passias`, | ||
:py:func:`pvlib.shading.masking_angle_passias`, and | ||
:py:func:`pvlib.shading.masking_angle` to model diffuse shading loss. | ||
(:pull:`1017`) | ||
* Add :py:func:`pvlib.inverter.fit_sandia` that fits the Sandia inverter model | ||
to a set of inverter efficiency curves. (:pull:`1011`) | ||
* Add :py:func:`pvlib.ivtools.sdm.fit_pvsyst_sandia` and :py:func:`pvlib.ivtools.sdm.fit_desoto_sandia` | ||
for fitting the Pvsyst and De Soto models to IV curve data (:issue:`227`)(:pull:`708`) | ||
* Add factory methods :py:meth:`~pvlib.modelchain.ModelChain.with_pvwatts` | ||
:py:meth:`~pvlib.modelchain.ModelChain.with_sapm` to create ``ModelChain`` | ||
objects configured for the respective modeling paradigms. The | ||
configurations are defined in ``modelchain.PVWATTS_CONFIG``, and | ||
``modelchain.SAPM_CONFIG``. (:issue:`1013`, :pull:`1022`) | ||
* Added *racking_model*, *module_type*, and *temperature_model_parameters* to | ||
PVSystem, LocalizedPVSystem, SingleAxisTracker, and | ||
LocalizedSingleAxisTracker repr methods. (:issue:`1027`) | ||
* Added ability for :py:func:`pvlib.soiling.hsu` to accept arbitrary time intervals. (:pull:`980`) |
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.
@btaute one more merge issue here and then we'll be done. sorry for the hassle
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.
Okay. I took one more stab at it.
Thanks @btaute! |
Added irradiance_loss_pvsyst function to pvsystem module and method to PVSystem class.
Partially addresses Issue #988.
I still need to incorporate tests and update the "what's new" file. I'm hoping for some feedback on implementation before starting those.
Thank you for your review.
docs/sphinx/source/api.rst
for API changes.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`
).