-
Notifications
You must be signed in to change notification settings - Fork 963
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
updated first_solar_spectral_correction within atmosphere.py #208
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
from __future__ import division | ||
|
||
import numpy as np | ||
from warnings import warn | ||
|
||
APPARENT_ZENITH_MODELS = ('simple', 'kasten1966', 'kastenyoung1989', | ||
'gueymard1993', 'pickering2002') | ||
|
@@ -339,7 +340,7 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
.. math:: | ||
|
||
M = c_1 + c_2*AMa + c_3*Pwat + c_4*AMa^.5 | ||
+ c_5*Pwat^.5 + c_6*AMa/Pwat | ||
+ c_5*Pwat^.5 + c_6*AMa/Pwat^.5 | ||
|
||
Default coefficients are determined for several cell types with | ||
known quantum efficiency curves, by using the Simple Model of the | ||
|
@@ -348,7 +349,7 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
Pwat where: | ||
|
||
* 0.5 cm <= Pwat <= 5 cm | ||
* 0.8 <= AMa <= 4.75 (Pressure of 800 mbar and 1.01 <= AM <= 6) | ||
* 1.0 <= AMa <= 5.0 | ||
* Spectral range is limited to that of CMP11 (280 nm to 2800 nm) | ||
* spectrum simulated on a plane normal to the sun | ||
* All other parameters fixed at G173 standard | ||
|
@@ -358,14 +359,14 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
applied to fit Eq. 1 to determine the coefficients for each module. | ||
|
||
Based on the PVLIB Matlab function ``pvl_FSspeccorr`` by Mitchell | ||
Lee and Alex Panchula, at First Solar, 2015. | ||
Lee and Alex Panchula, at First Solar, 2016 [2]_. | ||
|
||
Parameters | ||
---------- | ||
pw : array-like | ||
atmospheric precipitable water (cm). | ||
|
||
airmass_absolute : | ||
airmass_absolute : array-like | ||
absolute (pressure corrected) airmass. | ||
|
||
module_type : None or string | ||
|
@@ -380,7 +381,7 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
|
||
The module used to calculate the spectral correction | ||
coefficients corresponds to the Mult-crystalline silicon | ||
Manufacturer 2 Model C from [2]_. | ||
Manufacturer 2 Model C from [3]_. | ||
|
||
coefficients : array-like | ||
allows for entry of user defined spectral correction | ||
|
@@ -406,20 +407,58 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
.. [1] Gueymard, Christian. SMARTS2: a simple model of the atmospheric | ||
radiative transfer of sunshine: algorithms and performance | ||
assessment. Cocoa, FL: Florida Solar Energy Center, 1995. | ||
|
||
.. [2] Marion, William F., et al. User's Manual for Data for Validating | ||
.. [2] Lee, Mitchell, and Panchula, Alex. "Spectral Correction for | ||
Photovoltaic Module Performance Based on Air Mass and Precipitable | ||
Water." IEEE Photovoltaic Specialists Conference, Portland, 2016 | ||
.. [3] Marion, William F., et al. User's Manual for Data for Validating | ||
Models for PV Module Performance. National Renewable Energy | ||
Laboratory, 2014. http://www.nrel.gov/docs/fy14osti/61610.pdf | ||
""" | ||
|
||
import pdb | ||
pdb.set_trace() | ||
|
||
# --- Screen Input Data --- | ||
|
||
# *** Pwat *** | ||
# Replace Pwat Values below 0.1 cm with 0.1 cm to prevent model from | ||
# diverging" | ||
|
||
if np.min(pw) < 0.1: | ||
pw = np.maximum(pw, 0.1) | ||
warn('Exceptionally low Pwat values replaced with 0.1 cm to prevent'+ | ||
' model divergence') | ||
|
||
|
||
# Warn user about Pwat data that is exceptionally high | ||
if np.max(pw) > 8: | ||
warn('Exceptionally high Pwat values. Check input data:' + | ||
' model may diverge in this range') | ||
|
||
|
||
# *** AMa *** | ||
# Replace Extremely High AM with AM 10 to prevent model divergence | ||
# AM > 10 will only occur very close to sunset | ||
if np.max(airmass_absolute) > 10: | ||
airmass_absolute = np.minimum(airmass_absolute,10) | ||
|
||
# Warn user about AMa data that is exceptionally low | ||
if np.min(airmass_absolute) < 0.58: | ||
warn('Exceptionally low air mass: ' + | ||
'model not intended for extra-terrestrial use') | ||
# pvl_absoluteairmass(1,pvl_alt2pres(4340)) = 0.58 | ||
# Elevation of Mina Pirquita, Argentian = 4340 m. Highest elevation city | ||
# with population over 50,000. | ||
|
||
|
||
_coefficients = {} | ||
_coefficients['cdte'] = ( | ||
0.87102, -0.040543, -0.00929202, 0.10052, 0.073062, -0.0034187) | ||
0.86273, -0.038948, -0.012506, 0.098871, 0.084658, -0.0042948) | ||
_coefficients['monosi'] = ( | ||
0.86588, -0.021637, -0.0030218, 0.12081, 0.017514, -0.0012610) | ||
0.85914, -0.020880, -0.0058853, 0.12029, 0.026814, -0.0017810) | ||
_coefficients['xsi'] = _coefficients['monosi'] | ||
_coefficients['polysi'] = ( | ||
0.84674, -0.028568, -0.0051832, 0.13669, 0.029234, -0.0014207) | ||
0.84090, -0.027539, -0.0079224, 0.13570, 0.038024, -0.0021218) | ||
_coefficients['multisi'] = _coefficients['polysi'] | ||
|
||
if module_type is not None and coefficients is None: | ||
|
@@ -435,6 +474,6 @@ def first_solar_spectral_correction(pw, airmass_absolute, module_type=None, | |
AMa = airmass_absolute | ||
modifier = ( | ||
coeff[0] + coeff[1]*AMa + coeff[2]*pw + coeff[3]*np.sqrt(AMa) + | ||
+ coeff[4]*np.sqrt(pw) + coeff[5]*AMa/pw) | ||
+ coeff[4]*np.sqrt(pw) + coeff[5]*AMa/np.sqrt(pw)) | ||
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. looks like I made a mistake when I first ported this and put two + signs here (one on each line). Let's keep only the first one. |
||
|
||
return modifier |
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.
You'll need to delete these pdb lines. They prevent the test suite from completing.