Add JRC spectral factor correction#2088
Conversation
echedey-ls
left a comment
There was a problem hiding this comment.
Some comments down below. Feel free to apply suggestions with your own style.
| _coefficients['cdte'] = (0.000643, 0.000130, 0.0000108) | ||
|
|
||
| if module_type is not None and coefficients is None: | ||
| coefficients = _coefficients[module_type.lower()] |
There was a problem hiding this comment.
I'm a bit in favour of handling KeyError's and having custom error messages with the available keys, but I remember some comment somewhere that deemed that unnecessary. Just in case someone else wants to weight in, I'm not requesting changes.
Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
|
Think I've made all the changes recommended so far from @echedey-ls @cwhanse. Let me know if there is anything else |
cwhanse
left a comment
There was a problem hiding this comment.
Add an entry to whatsnew and LGTM
|
I don't quite understand the derivation of the mismatch equation. Eq. (2) in the model includes the reference specific SC current. By definition of the mismatch: I think the specific sc current denoted in the paper must be included as described above. Feel free to correct me if I'm wrong. |
|
@echedey-ls I*_sc0 can be divided out of the constant terms k_1, k_2, k_3 so the equation is correct without the I*_sc0 denominator, but I need to update the table of coefficients for these two specific modules. |
|
That's good from my side, but a few thoughts:
|
|
@echedey-ls ah, I just saw your comment after working on the commit. I understand your point. |
|
I think the function should return the mismatch multiplier I'm inclined to not ask for The built-in parameters can be computed within the function, so that it is explicit how to connect the code back to the paper. |
include normalisation calculation for built in coeff inside the function adjust tests --- additional calculation seems to affect this(?)
|
see last commit --- @cwhanse did I understand your suggestion correctly? include the division for built-in coefficients inside the function? |
|
That way of solving it is completely valid. An alternative would be to use a pandas dataframe to include all the coefficients, Isc* and only make the division when needed. E.g.: coeffs = pd.DataFrame(
index=["CdTe", "si"],
columns=["Isc*", "k_1", "k_2", "k_3"],
data=[
[Isc, k1, k2, k3], # cdte
[Ics, k1, k2, k3], # si
]
if use_internal_coeffs:
eq_coeffs = coeffs.loc["CdTe"] / coeffs.loc["CdTe"]["Isc*"]
# use k1 as eq.coeffs["k_1"], etc.But as a wise man once said, if it works don't touch it. Unfortunately I don't find a relevant xkcd. Jokes and suggestions aside, right now there is no way of passing in a custom Since it would mix different types of coefficients and their units, the API for a function like this must be well-thought. With the pandas approach above, for example, you could say these external coeffs could be a dict or pd.Series with keys ["Isc*", "k_1", "k_2", "k_3"]. That's what I find easier to expose, thou there are other alternatives. E.g.: adding parameters. Feel free to come up with other approaches too. |
Your changes are what I had in mind. @echedey-ls I think we can define the |
|
I have updated the notes section of the docs to explain that the built-in coefficients differ from those published in the original manuscript. Feel free to recommend changes to phrasing there. |
Co-authored-by: Cliff Hansen <cwhanse@sandia.gov>
line length
echedey-ls
left a comment
There was a problem hiding this comment.
LGTM, thou I would try to clarify the airmass type before merging. I'm +1 to email the authors.
Co-authored-by: Echedey Luis <80125792+echedey-ls@users.noreply.github.com>
kandersolar
left a comment
There was a problem hiding this comment.
One minor note, otherwise LGTM
|
Great job @RDaxini! Many thanks to @echedey-ls, @cwhanse, and @kandersolar for some great discussions |
|
Thanks all:) |
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.Would like some advice on some questions raised in #2087 regarding citations and the
airmassparameter.Docs: https://pvlib-python--2088.org.readthedocs.build/en/2088/reference/generated/pvlib.spectrum.spectral_factor_jrc.html?highlight=jrc#pvlib.spectrum.spectral_factor_jrc