Repository navigation
Use effective irradiance directly in temperature.noct_sam - #2905
asystemoffields wants to merge 2 commits into
Conversation
Match SAM's corrected NOCT cell temperature model (NatLabRockies/ssc#1233): the temperature rise is computed from the effective irradiance, and the transmittance-absorptance product is no longer scaled by the ratio of effective to total irradiance. Previously, reflection losses did not reduce the modeled temperature of an open-circuit module, and small ratios gave cell temperatures below ambient. The first parameter of noct_sam is now effective_irradiance, poa_global is removed, and the optional parameters are keyword-only. The previous signature is accepted with a deprecation warning until v0.18.0. PVSystem.get_cell_temperature uses effective_irradiance when given and poa_global otherwise. Closes pvlib#1462 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Hey @asystemoffields! 🎉Thanks for opening your first pull request! We appreciate your If AI is used for any portion of this PR, you must vet the content Finally, be sure the PR description includes the PR |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
I compared this with SAM's One problem in the legacy shim. A call that passes noct_sam(1000, 25, 1, 45, 0.2, None) # 0.16.1 gives 55.2308
noct_sam(1000, 25, 1, 45, 0.2, None, 0.85) # 0.16.1 gives 54.7227
# TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'The first = args[0] if args[5] is None else args[5]
args = (first,) + tuple(args[1:5])Might be worth a test for the positional |
| " transmittance_absorptance, array_height and" | ||
| " mount_standoff by keyword.") | ||
| kwargs.update(zip(legacy_optional, args[6:])) | ||
| args = (args[5],) + tuple(args[1:5]) |
There was a problem hiding this comment.
| args = (args[5],) + tuple(args[1:5]) | |
| first = args[0] if args[5] is None else args[5] | |
| args = (first,) + tuple(args[1:5]) |
The fix from my comment above, as a suggestion.
|
This fix should be done by someone who understands PV temperature modeling. |
docs/sphinx/source/referencefor API changes. (no functions added or removed)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.Summary
noct_samfolded the ratioeffective_irradiance / poa_globalintotransmittance_absorptance, so the temperature rise still scaled withpoa_global. SAM corrected the same model in NatLabRockies/ssc#1233 (merged 2024-11-04) to use the effective irradiance directly, as discussed in #1462. This PR follows SAM and the design @cwhanse described in #2612: the cell temperature is calculated fromeffective_irradiance,poa_globalis removed, and the optional parameters become keyword-only. The previous signature keeps working with apvlibDeprecationWarninguntil v0.18.0.What changes for users
noct_sam(effective_irradiance, temp_air, wind_speed, noct, module_efficiency, *, transmittance_absorptance=0.9, array_height=1, mount_standoff=4).poa_globalget the same numbers as before (the old code usedpoa_globaldirectly wheneffective_irradiancewas not given).effective_irradiance, which includes everyModelChainrun withtemperature_model='noct_sam', now get the corrected temperature.PVSystem.get_cell_temperature(..., model='noct_sam')useseffective_irradiancewhen given andpoa_globalotherwise.Evidence
The issue's example (NOCT 41.6 °C, 800 W/m² POA, 20 °C air, wind 1/0.51 m/s), with effective irradiance at 75 % and 20 % of POA:
mainComparison with SAM's own engine (NREL-PySAM 7.1.1,
Pvsamv1default "FlatPlatePVSingleOwner" with the NOCT model, fixed tilt 20°, monofacial, soiling and snow off, weatherpvlib/data/723170TYA.CSV). Both pvlib versions were fed SAM's POA before reflection, POA after reflection times the air-mass modifier, air temperature and wind speed, and compared withsubarray1_celltempSSover the 4063 daytime hours with a temperature rise above 0.5 °C:noct_samonmainThe previous
test_noct_sam_against_samreference (43.0655 °C, SAM 2020.11.29) encoded the pre-#1233 behaviour; the test now checks three hours of the run above, andtest_PVSystem_noct_celltemp_against_samchecks theModelChainpath (both irradiances given) against the same run.Script used for the SAM comparison
Deprecation path
_noct_sam_legacy_signature(temperature.py) accepts the pre-0.16.2 call patterns and warns:effective_irradiancepassed positionally as the sixth argument (with or without the options after it), a positionalpoa_globaltogether with keywordeffective_irradiance, keywordpoa_global, and an expliciteffective_irradiance=None. New-style calls don't warn. The shim tests are decorated withfail_on_pvlib_version('0.18.0')so the shim can't be forgotten. Making the options keyword-only means an old-style call with six or more positional arguments raises aTypeErrorafter the shim is removed, instead of silently shiftingeffective_irradianceintotransmittance_absorptance.Options considered
effective_irradianceused when given,poa_globalotherwise). No deprecation, butpoa_globalstays as an unused parameter whenevereffective_irradianceis given.If the shim is more than you want to carry, I can switch to B.
Testing
test_noct_sam,test_noct_sam_against_sam,test_noct_sam_options,test_noct_sam_effective_irradiance,test_noct_sam_new_signature_no_warning,test_noct_sam_legacy_signature,test_PVSystem_noct_celltemp,test_PVSystem_noct_celltemp_against_sam.test_noct_sam_legacy_signature,test_noct_sam_new_signature_no_warning,test_PVSystem_noct_celltemp,test_PVSystem_noct_celltemp_against_sam).Caveats
(Investigated, implemented and drafted with Claude Code (Claude Fable 5.1); reviewed by the author before submission.)
🤖 Generated with Claude Code