-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Accept albedo in weather input to ModelChain.run_model method #1469
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
Changes from 15 commits
d0c52b6
e64a940
de34639
0fa45e8
cdf853e
b3ee156
9e1ce0e
59a37da
0295dd0
b9a7308
e518996
e4c5fa5
acb3657
2bd97b8
5f0d455
0a10e56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,7 +134,7 @@ class PVSystem: | |
a single array is created from the other parameters (e.g. | ||
`surface_tilt`, `surface_azimuth`). Must contain at least one Array, | ||
if length of arrays is 0 a ValueError is raised. If `arrays` is | ||
specified the following parameters are ignored: | ||
specified the following PVSystem parameters are ignored: | ||
|
||
- `surface_tilt` | ||
- `surface_azimuth` | ||
|
@@ -157,13 +157,16 @@ class PVSystem: | |
North=0, East=90, South=180, West=270. | ||
|
||
albedo : None or float, default None | ||
The ground albedo. If ``None``, will attempt to use | ||
``surface_type`` and ``irradiance.SURFACE_ALBEDOS`` | ||
to lookup albedo. | ||
Ground surface albedo. If ``None``, then ``surface_type`` is used | ||
to look up a value in ``irradiance.SURFACE_ALBEDOS``. | ||
If ``surface_type`` is also None then a ground surface albedo | ||
of 0.25 is used. For time-dependent albedos, add ``'albedo'`` to | ||
the input ``'weather'`` DataFrame for | ||
:py:class:`pvlib.modelchain.ModelChain` methods. | ||
|
||
surface_type : None or string, default None | ||
The ground surface type. See ``irradiance.SURFACE_ALBEDOS`` | ||
for valid values. | ||
The ground surface type. See ``irradiance.SURFACE_ALBEDOS`` for | ||
valid values. | ||
|
||
module : None or string, default None | ||
The model name of the modules. | ||
|
@@ -333,13 +336,12 @@ def get_aoi(self, solar_zenith, solar_azimuth): | |
|
||
@_unwrap_single_value | ||
def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | ||
dni_extra=None, airmass=None, model='haydavies', | ||
**kwargs): | ||
dni_extra=None, airmass=None, | ||
model='haydavies', **kwargs): | ||
""" | ||
Uses the :py:func:`irradiance.get_total_irradiance` function to | ||
calculate the plane of array irradiance components on a tilted | ||
surface defined by ``self.surface_tilt``, | ||
``self.surface_azimuth``, and ``self.albedo``. | ||
surface defined by ``self.surface_tilt`` and ``self.surface_azimuth```. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -348,15 +350,15 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | |
solar_azimuth : float or Series. | ||
Solar azimuth angle. | ||
dni : float or Series or tuple of float or Series | ||
Direct Normal Irradiance | ||
Direct Normal Irradiance. [W/m2] | ||
ghi : float or Series or tuple of float or Series | ||
Global horizontal irradiance | ||
Global horizontal irradiance. [W/m2] | ||
dhi : float or Series or tuple of float or Series | ||
Diffuse horizontal irradiance | ||
Diffuse horizontal irradiance. [W/m2] | ||
dni_extra : None, float or Series, default None | ||
Extraterrestrial direct normal irradiance | ||
Extraterrestrial direct normal irradiance [W/m2] | ||
airmass : None, float or Series, default None | ||
Airmass | ||
Airmass. [unitless] | ||
model : String, default 'haydavies' | ||
Irradiance model. | ||
|
||
|
@@ -376,17 +378,29 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | |
poa_irradiance : DataFrame or tuple of DataFrame | ||
Column names are: ``'poa_global', 'poa_direct', 'poa_diffuse', | ||
'poa_sky_diffuse', 'poa_ground_diffuse'``. | ||
|
||
See also | ||
-------- | ||
:py:func:`pvlib.irradiance.get_total_irradiance` | ||
""" | ||
dni = self._validate_per_array(dni, system_wide=True) | ||
ghi = self._validate_per_array(ghi, system_wide=True) | ||
dhi = self._validate_per_array(dhi, system_wide=True) | ||
|
||
try: | ||
albedo = kwargs.pop('albedo') | ||
except KeyError: | ||
albedo = None | ||
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. Why not include 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.
It seems odd to add |
||
albedo = self._validate_per_array(albedo, system_wide=True) | ||
|
||
return tuple( | ||
array.get_irradiance(solar_zenith, solar_azimuth, | ||
dni, ghi, dhi, | ||
albedo, | ||
dni_extra, airmass, model, | ||
**kwargs) | ||
for array, dni, ghi, dhi in zip( | ||
self.arrays, dni, ghi, dhi | ||
for array, dni, ghi, dhi, albedo in zip( | ||
self.arrays, dni, ghi, dhi, albedo | ||
) | ||
) | ||
|
||
|
@@ -1258,14 +1272,14 @@ class Array: | |
If not provided, a FixedMount with zero tilt is used. | ||
|
||
albedo : None or float, default None | ||
The ground albedo. If ``None``, will attempt to use | ||
``surface_type`` to look up an albedo value in | ||
``irradiance.SURFACE_ALBEDOS``. If a surface albedo | ||
cannot be found then 0.25 is used. | ||
Ground surface albedo. If ``None``, then ``surface_type`` is used | ||
to look up a value in ``irradiance.SURFACE_ALBEDOS``. | ||
If ``surface_type`` is also None then a ground surface albedo | ||
of 0.25 is used. | ||
|
||
surface_type : None or string, default None | ||
The ground surface type. See ``irradiance.SURFACE_ALBEDOS`` | ||
for valid values. | ||
The ground surface type. See ``irradiance.SURFACE_ALBEDOS`` for valid | ||
values. | ||
|
||
module : None or string, default None | ||
The model name of the modules. | ||
|
@@ -1425,15 +1439,14 @@ def get_aoi(self, solar_zenith, solar_azimuth): | |
solar_zenith, solar_azimuth) | ||
|
||
def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | ||
dni_extra=None, airmass=None, model='haydavies', | ||
**kwargs): | ||
albedo=None, dni_extra=None, airmass=None, | ||
model='haydavies', **kwargs): | ||
""" | ||
Get plane of array irradiance components. | ||
|
||
Uses the :py:func:`pvlib.irradiance.get_total_irradiance` function to | ||
calculate the plane of array irradiance components for a surface | ||
defined by ``self.surface_tilt`` and ``self.surface_azimuth`` with | ||
albedo ``self.albedo``. | ||
defined by ``self.surface_tilt`` and ``self.surface_azimuth``. | ||
|
||
Parameters | ||
---------- | ||
|
@@ -1442,15 +1455,17 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | |
solar_azimuth : float or Series. | ||
Solar azimuth angle. | ||
dni : float or Series | ||
Direct Normal Irradiance | ||
ghi : float or Series | ||
Direct normal irradiance. [W/m2] | ||
ghi : float or Series. [W/m2] | ||
Global horizontal irradiance | ||
dhi : float or Series | ||
Diffuse horizontal irradiance | ||
Diffuse horizontal irradiance. [W/m2] | ||
albedo : None, float or Series, default None | ||
Ground surface albedo. [unitless] | ||
dni_extra : None, float or Series, default None | ||
Extraterrestrial direct normal irradiance | ||
Extraterrestrial direct normal irradiance. [W/m2] | ||
airmass : None, float or Series, default None | ||
Airmass | ||
Airmass. [unitless] | ||
model : String, default 'haydavies' | ||
Irradiance model. | ||
|
||
|
@@ -1463,7 +1478,14 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | |
poa_irradiance : DataFrame | ||
Column names are: ``'poa_global', 'poa_direct', 'poa_diffuse', | ||
'poa_sky_diffuse', 'poa_ground_diffuse'``. | ||
|
||
See also | ||
-------- | ||
:py:func:`pvlib.irradiance.get_total_irradiance` | ||
""" | ||
if albedo is None: | ||
albedo = self.albedo | ||
|
||
# not needed for all models, but this is easier | ||
if dni_extra is None: | ||
dni_extra = irradiance.get_extra_radiation(solar_zenith.index) | ||
|
@@ -1476,10 +1498,10 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi, | |
orientation['surface_azimuth'], | ||
solar_zenith, solar_azimuth, | ||
dni, ghi, dhi, | ||
albedo=albedo, | ||
dni_extra=dni_extra, | ||
airmass=airmass, | ||
model=model, | ||
albedo=self.albedo, | ||
**kwargs) | ||
|
||
def get_iam(self, aoi, iam_model='physical'): | ||
|
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 suppose the
PVSystem
andArray
changes should be noted too