Skip to content

Commit 7d27df9

Browse files
authored
Merge branch 'master' into master
2 parents 2498040 + 5bfd870 commit 7d27df9

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

pvlib/data/sam-library-cec-inverters-2018-3-18.csv

+1
Original file line numberDiff line numberDiff line change
@@ -2505,6 +2505,7 @@ LeadSolar Energy: LS600 [240V] 240V [CEC 2018],240,500,524.883,36,1.95681,-3.049
25052505
LeadSolar Energy: LS600ES 277V [CEC 2014],277,600,624.32414,27.03322619,2.57570801,-1.13E-05,-1.34E-04,6.35E-02,0.119358397,0.04,60,19.4,27,45
25062506
LeadSolar Energy: LS600ES [277V] 277V [CEC 2018],277,600,624.486,54,2.56291,-1.15006e-005,2.48251e-005,0.0534707,0.122932,0.04,56,11.5646,52,56
25072507
LeadSolar Energy: LS600T (208V) 208V [CEC 2014],208,500,527.5554744,35.98932976,2.868916375,-4.73E-05,-1.02E-03,1.57E-02,-5.39E-02,1,60,19.4,27,45
2508+
LeadSolar Energy: LS600T [208V] 208V [CEC 2018],208,500,75790.4,36,-nan(ind),1.22899e-07,-0.0251886,-nan(ind),0.0798754,1,45,2105.29,27,45
25082509
LeadSolar Energy: LS650S 277V [CEC 2014],277,650,676.7493403,54.0729254,2.38789227,-9.80E-06,-2.17E-04,5.41E-02,6.69E-02,0.04,60,19.4,52,56
25092510
LeadSolar Energy: LS650S [277V] 277V [CEC 2018],277,650,676.704,54,2.30605,-8.83925e-006,-0.000202645,0.04063,0.0452291,0.04,56,12.5316,52,56
25102511
LeadSolar Energy: LS700S 277V [CEC 2014],277,700,729.7125005,54.07850476,2.024489833,-7.75E-06,-3.55E-04,7.09E-02,0.101741464,0.04,60,19.4,52,56

pvlib/irradiance.py

+36-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from __future__ import division
88

9+
import logging
10+
911
import datetime
1012
from collections import OrderedDict
1113
from functools import partial
@@ -17,7 +19,8 @@
1719
from pvlib import solarposition
1820
from pvlib import atmosphere
1921

20-
# see References section of grounddiffuse function
22+
pvl_logger = logging.getLogger('pvlib')
23+
2124
SURFACE_ALBEDOS = {'urban': 0.18,
2225
'grass': 0.20,
2326
'fresh grass': 0.26,
@@ -30,8 +33,7 @@
3033
'aluminum': 0.85,
3134
'copper': 0.74,
3235
'fresh steel': 0.35,
33-
'dirty steel': 0.08,
34-
'sea': 0.06}
36+
'dirty steel': 0.08}
3537

3638

3739
def extraradiation(datetime_or_doy, solar_constant=1366.1, method='spencer',
@@ -343,6 +345,8 @@ def total_irrad(surface_tilt, surface_azimuth,
343345
'poa_sky_diffuse', 'poa_ground_diffuse'``.
344346
"""
345347

348+
pvl_logger.debug('planeofarray.total_irrad()')
349+
346350
solar_zenith = apparent_zenith
347351
solar_azimuth = azimuth
348352

@@ -471,8 +475,8 @@ def grounddiffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
471475
472476
surface_type: None or string, default None
473477
If not None, overrides albedo. String can be one of ``'urban',
474-
'grass', 'fresh grass', 'snow', 'fresh snow', 'asphalt', 'concrete',
475-
'aluminum', 'copper', 'fresh steel', 'dirty steel', 'sea'``.
478+
'grass', 'fresh grass', 'snow', 'fresh snow', 'asphalt',
479+
'concrete', 'aluminum', 'copper', 'fresh steel', 'dirty steel'``.
476480
477481
Returns
478482
-------
@@ -489,15 +493,17 @@ def grounddiffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
489493
The calculation is the last term of equations 3, 4, 7, 8, 10, 11, and 12.
490494
491495
[2] albedos from:
492-
http://files.pvsyst.com/help/albedo.htm
496+
http://pvpmc.org/modeling-steps/incident-irradiance/plane-of-array-poa-irradiance/calculating-poa-irradiance/poa-ground-reflected/albedo/
493497
and
494498
http://en.wikipedia.org/wiki/Albedo
495-
and
496-
https://doi.org/10.1175/1520-0469(1972)029<0959:AOTSS>2.0.CO;2
497499
'''
498500

501+
pvl_logger.debug('diffuse_ground.get_diffuse_ground()')
502+
499503
if surface_type is not None:
500504
albedo = SURFACE_ALBEDOS[surface_type]
505+
pvl_logger.info('surface_type=%s mapped to albedo=%s',
506+
surface_type, albedo)
501507

502508
diffuse_irrad = ghi * albedo * (1 - np.cos(np.radians(surface_tilt))) * 0.5
503509

@@ -549,6 +555,8 @@ def isotropic(surface_tilt, dhi):
549555
heat collector. Trans. ASME 64, 91.
550556
'''
551557

558+
pvl_logger.debug('diffuse_sky.isotropic()')
559+
552560
sky_diffuse = dhi * (1 + tools.cosd(surface_tilt)) * 0.5
553561

554562
return sky_diffuse
@@ -620,6 +628,8 @@ def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
620628
tilted surfaces. Solar Energy 23 (2), 111-114.
621629
'''
622630

631+
pvl_logger.debug('diffuse_sky.klucher()')
632+
623633
# zenith angle with respect to panel normal.
624634
cos_tt = aoi_projection(surface_tilt, surface_azimuth,
625635
solar_zenith, solar_azimuth)
@@ -709,6 +719,8 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
709719
Ministry of Supply and Services, Canada.
710720
'''
711721

722+
pvl_logger.debug('diffuse_sky.haydavies()')
723+
712724
# if necessary, calculate ratio of titled and horizontal beam irradiance
713725
if projection_ratio is None:
714726
cos_tt = aoi_projection(surface_tilt, surface_azimuth,
@@ -807,6 +819,8 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
807819
hourly tilted surface radiation models. Solar Energy 45(1), 9-17.
808820
'''
809821

822+
pvl_logger.debug('diffuse_sky.reindl()')
823+
810824
cos_tt = aoi_projection(surface_tilt, surface_azimuth,
811825
solar_zenith, solar_azimuth)
812826

@@ -867,6 +881,8 @@ def king(surface_tilt, dhi, ghi, solar_zenith):
867881
The diffuse component of the solar radiation.
868882
'''
869883

884+
pvl_logger.debug('diffuse_sky.king()')
885+
870886
sky_diffuse = (dhi * ((1 + tools.cosd(surface_tilt))) / 2 + ghi *
871887
((0.012 * solar_zenith - 0.04)) *
872888
((1 - tools.cosd(surface_tilt))) / 2)
@@ -979,8 +995,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
979995
delta = dhi * airmass / dni_extra
980996

981997
# epsilon is the sky's "clearness"
982-
with np.errstate(invalid='ignore'):
983-
eps = ((dhi + dni) / dhi + kappa * (z ** 3)) / (1 + kappa * (z ** 3))
998+
eps = ((dhi + dni) / dhi + kappa * (z ** 3)) / (1 + kappa * (z ** 3))
984999

9851000
# numpy indexing below will not work with a Series
9861001
if isinstance(eps, pd.Series):
@@ -990,8 +1005,15 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
9901005
# rules. 1 = overcast ... 8 = clear (these names really only make
9911006
# sense for small zenith angles, but...) these values will
9921007
# eventually be used as indicies for coeffecient look ups
993-
ebin = np.digitize(eps, (0., 1.065, 1.23, 1.5, 1.95, 2.8, 4.5, 6.2))
994-
ebin[np.isnan(eps)] = 0
1008+
ebin = np.zeros_like(eps, dtype=np.int8)
1009+
ebin[eps < 1.065] = 1
1010+
ebin[(eps >= 1.065) & (eps < 1.23)] = 2
1011+
ebin[(eps >= 1.23) & (eps < 1.5)] = 3
1012+
ebin[(eps >= 1.5) & (eps < 1.95)] = 4
1013+
ebin[(eps >= 1.95) & (eps < 2.8)] = 5
1014+
ebin[(eps >= 2.8) & (eps < 4.5)] = 6
1015+
ebin[(eps >= 4.5) & (eps < 6.2)] = 7
1016+
ebin[eps >= 6.2] = 8
9951017

9961018
# correct for 0 indexing in coeffecient lookup
9971019
# later, ebin = -1 will yield nan coefficients
@@ -1311,7 +1333,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325.,
13111333
Determine DNI from GHI using the DIRINDEX model, which is a modification of
13121334
the DIRINT model with information from a clear sky model.
13131335
1314-
DIRINDEX [1] improves upon the DIRINT model by taking into account
1336+
DIRINDEX [1] improves upon the DIRINT model by taking into account
13151337
turbidity when used with the Ineichen clear sky model results.
13161338
13171339
Parameters
@@ -1374,7 +1396,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325.,
13741396
use_delta_kt_prime=use_delta_kt_prime,
13751397
temp_dew=temp_dew)
13761398

1377-
dni_dirint_clearsky = dirint(ghi_clearsky, zenith, times,
1399+
dni_dirint_clearsky = dirint(ghi_clearsky, zenith, times,
13781400
pressure=pressure,
13791401
use_delta_kt_prime=use_delta_kt_prime,
13801402
temp_dew=temp_dew)

0 commit comments

Comments
 (0)