-
Notifications
You must be signed in to change notification settings - Fork 1.1k
NOCT cell temperature function #1177
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ad30ffe
initial code for noct cell temperature function
cwhanse 7ab38cd
error message, test, docs
cwhanse 5bf2eef
complete the docstring
cwhanse 31240db
correct noct function, adjust tests, add comments
cwhanse 077c684
Revert "correct noct function, adjust tests, add comments"
cwhanse f4d6622
redo function fixes and tests
cwhanse 1bd108b
finish redo of edits
cwhanse abdfccb
fix tests, change name to noct_sam
cwhanse 442dd26
add test to reproduce SAM output
cwhanse 2c0b224
format, fix text asserts
cwhanse 88ebe92
more assert fixes, add rtol
cwhanse 74494f3
fix tes
cwhanse 9e3c6f3
docstring format
cwhanse 979734b
fixes from review
cwhanse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -706,3 +706,109 @@ def fuentes(poa_global, temp_air, wind_speed, noct_installed, module_height=5, | |
sun0 = sun | ||
|
||
return pd.Series(tmod_array - 273.15, index=poa_global.index, name='tmod') | ||
|
||
|
||
def _adj_for_mounting_standoff(x): | ||
# supports noct cell temperature function. Except for x > 3.5, the SAM code | ||
# and documentation aren't clear on the precise intervals. The choice of | ||
# < or <= here is pvlib's. | ||
return np.piecewise(x, [x <= 0, (x > 0) & (x < 0.5), | ||
(x >= 0.5) & (x < 1.5), (x >= 1.5) & (x < 2.5), | ||
(x >= 2.5) & (x <= 3.5), x > 3.5], | ||
[0., 18., 11., 6., 2., 0.]) | ||
|
||
|
||
def noct_sam(poa_global, temp_air, wind_speed, noct, eta_m_ref, | ||
effective_irradiance=None, transmittance_absorptance=0.9, | ||
array_height=1, mount_standoff=4): | ||
r''' | ||
Cell temperature model from the System Advisor Model (SAM). | ||
|
||
The model is described in [1]_, Section 10.6. | ||
|
||
Parameters | ||
---------- | ||
poa_global : numeric | ||
Total incident irradiance. [W/m^2] | ||
|
||
temp_air : numeric | ||
Ambient dry bulb temperature. [C] | ||
|
||
wind_speed : numeric | ||
Wind speed in m/s measured at the same height for which the wind loss | ||
factor was determined. The default value 1.0 m/s is the wind | ||
speed at module height used to determine NOCT. [m/s] | ||
|
||
noct : float | ||
Nominal operating cell temperature [C], determined at conditions of | ||
800 W/m^2 irradiance, 20 C ambient air temperature and 1 m/s wind. | ||
|
||
eta_m_ref : float | ||
Module external efficiency [unitless] at reference conditions of | ||
1000 W/m^2 and 20C. Calculate as | ||
:math:`\eta_{m} = \frac{V_{mp} I_{mp}}{A \times 1000 W/m^2}` | ||
where A is module area [m^2]. | ||
|
||
effective_irradiance : numeric, default None. | ||
The irradiance that is converted to photocurrent. If None, | ||
assumed equal to poa_global. [W/m^2] | ||
|
||
transmittance_absorptance : numeric, default 0.9 | ||
Coefficient for combined transmittance and absorptance effects. | ||
[unitless] | ||
|
||
array_height : int, default 1 | ||
Height of array above ground in stories (one story is about 3m). Must | ||
be either 1 or 2. For systems elevated less than one story, use 1. | ||
If system is elevated more than two stories, use 2. | ||
|
||
mount_standoff : numeric, default 4 | ||
Distance between array mounting and mounting surface. Use default | ||
if system is ground-mounted. [inches] | ||
|
||
Returns | ||
------- | ||
cell_temperature : numeric | ||
Cell temperature. [C] | ||
|
||
Raises | ||
------ | ||
ValueError | ||
If array_height is an invalid value (must be 1 or 2). | ||
|
||
References | ||
---------- | ||
.. [1] Gilman, P., Dobos, A., DiOrio, N., Freeman, J., Janzou, S., | ||
Ryberg, D., 2018, "SAM Photovoltaic Model Technical Reference | ||
Update", National Renewable Energy Laboratory Report | ||
NREL/TP-6A20-67399. | ||
''' | ||
# in [1] the denominator for irr_ratio isn't precisely clear. From | ||
# reproducing output of the SAM function noct_celltemp_t, we determined | ||
# that: | ||
# - G_total (SAM) is broadband plane-of-array irradiance before | ||
# reflections. Equivalent to pvlib variable poa_global | ||
# - Geff_total (SAM) is POA irradiance after reflections and | ||
# adjustment for spectrum. Equivalent to effective_irradiance | ||
if effective_irradiance is None: | ||
irr_ratio = 1. | ||
else: | ||
irr_ratio = effective_irradiance / poa_global | ||
|
||
if array_height == 1: | ||
wind_adj = 0.51 * wind_speed | ||
elif array_height == 2: | ||
wind_adj = 0.61 * wind_speed | ||
else: | ||
raise ValueError( | ||
f'array_height must be 1 or 2, {array_height} was given') | ||
|
||
noct_adj = noct + _adj_for_mounting_standoff(mount_standoff) | ||
tau_alpha = transmittance_absorptance * irr_ratio | ||
|
||
# [1] Eq. 10.37 isn't clear on exactly what "G" is. SAM SSC code uses | ||
# poa_global where G appears | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At the bottom of page 57 it says "The cell temperature is only calculated when the effective transmitted irradiance from Equation 10.25 is greater than zero, G>0.", and tracing back through to Eq 10.20 shows that |
||
cell_temp_init = poa_global / 800. * (noct_adj - 20.) | ||
heat_loss = 1 - eta_m_ref / tau_alpha | ||
wind_loss = 9.5 / (5.7 + 3.8 * wind_adj) | ||
return temp_air + cell_temp_init * heat_loss * wind_loss |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure this is correct. Eq 10.22 has the ratio as G0/G, where G0 is irradiance after reflections and G is after reflections and airmass.