6
6
7
7
from __future__ import division
8
8
9
+ import logging
10
+
9
11
import datetime
10
12
from collections import OrderedDict
11
13
from functools import partial
17
19
from pvlib import solarposition
18
20
from pvlib import atmosphere
19
21
20
- # see References section of grounddiffuse function
22
+ pvl_logger = logging .getLogger ('pvlib' )
23
+
21
24
SURFACE_ALBEDOS = {'urban' : 0.18 ,
22
25
'grass' : 0.20 ,
23
26
'fresh grass' : 0.26 ,
30
33
'aluminum' : 0.85 ,
31
34
'copper' : 0.74 ,
32
35
'fresh steel' : 0.35 ,
33
- 'dirty steel' : 0.08 ,
34
- 'sea' : 0.06 }
36
+ 'dirty steel' : 0.08 }
35
37
36
38
37
39
def extraradiation (datetime_or_doy , solar_constant = 1366.1 , method = 'spencer' ,
@@ -343,6 +345,8 @@ def total_irrad(surface_tilt, surface_azimuth,
343
345
'poa_sky_diffuse', 'poa_ground_diffuse'``.
344
346
"""
345
347
348
+ pvl_logger .debug ('planeofarray.total_irrad()' )
349
+
346
350
solar_zenith = apparent_zenith
347
351
solar_azimuth = azimuth
348
352
@@ -471,8 +475,8 @@ def grounddiffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
471
475
472
476
surface_type: None or string, default None
473
477
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'``.
476
480
477
481
Returns
478
482
-------
@@ -489,15 +493,17 @@ def grounddiffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
489
493
The calculation is the last term of equations 3, 4, 7, 8, 10, 11, and 12.
490
494
491
495
[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/
493
497
and
494
498
http://en.wikipedia.org/wiki/Albedo
495
- and
496
- https://doi.org/10.1175/1520-0469(1972)029<0959:AOTSS>2.0.CO;2
497
499
'''
498
500
501
+ pvl_logger .debug ('diffuse_ground.get_diffuse_ground()' )
502
+
499
503
if surface_type is not None :
500
504
albedo = SURFACE_ALBEDOS [surface_type ]
505
+ pvl_logger .info ('surface_type=%s mapped to albedo=%s' ,
506
+ surface_type , albedo )
501
507
502
508
diffuse_irrad = ghi * albedo * (1 - np .cos (np .radians (surface_tilt ))) * 0.5
503
509
@@ -549,6 +555,8 @@ def isotropic(surface_tilt, dhi):
549
555
heat collector. Trans. ASME 64, 91.
550
556
'''
551
557
558
+ pvl_logger .debug ('diffuse_sky.isotropic()' )
559
+
552
560
sky_diffuse = dhi * (1 + tools .cosd (surface_tilt )) * 0.5
553
561
554
562
return sky_diffuse
@@ -620,6 +628,8 @@ def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
620
628
tilted surfaces. Solar Energy 23 (2), 111-114.
621
629
'''
622
630
631
+ pvl_logger .debug ('diffuse_sky.klucher()' )
632
+
623
633
# zenith angle with respect to panel normal.
624
634
cos_tt = aoi_projection (surface_tilt , surface_azimuth ,
625
635
solar_zenith , solar_azimuth )
@@ -709,6 +719,8 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
709
719
Ministry of Supply and Services, Canada.
710
720
'''
711
721
722
+ pvl_logger .debug ('diffuse_sky.haydavies()' )
723
+
712
724
# if necessary, calculate ratio of titled and horizontal beam irradiance
713
725
if projection_ratio is None :
714
726
cos_tt = aoi_projection (surface_tilt , surface_azimuth ,
@@ -807,6 +819,8 @@ def reindl(surface_tilt, surface_azimuth, dhi, dni, ghi, dni_extra,
807
819
hourly tilted surface radiation models. Solar Energy 45(1), 9-17.
808
820
'''
809
821
822
+ pvl_logger .debug ('diffuse_sky.reindl()' )
823
+
810
824
cos_tt = aoi_projection (surface_tilt , surface_azimuth ,
811
825
solar_zenith , solar_azimuth )
812
826
@@ -867,6 +881,8 @@ def king(surface_tilt, dhi, ghi, solar_zenith):
867
881
The diffuse component of the solar radiation.
868
882
'''
869
883
884
+ pvl_logger .debug ('diffuse_sky.king()' )
885
+
870
886
sky_diffuse = (dhi * ((1 + tools .cosd (surface_tilt ))) / 2 + ghi *
871
887
((0.012 * solar_zenith - 0.04 )) *
872
888
((1 - tools .cosd (surface_tilt ))) / 2 )
@@ -979,8 +995,7 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
979
995
delta = dhi * airmass / dni_extra
980
996
981
997
# 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 ))
984
999
985
1000
# numpy indexing below will not work with a Series
986
1001
if isinstance (eps , pd .Series ):
@@ -990,8 +1005,15 @@ def perez(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
990
1005
# rules. 1 = overcast ... 8 = clear (these names really only make
991
1006
# sense for small zenith angles, but...) these values will
992
1007
# 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
995
1017
996
1018
# correct for 0 indexing in coeffecient lookup
997
1019
# later, ebin = -1 will yield nan coefficients
@@ -1311,7 +1333,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325.,
1311
1333
Determine DNI from GHI using the DIRINDEX model, which is a modification of
1312
1334
the DIRINT model with information from a clear sky model.
1313
1335
1314
- DIRINDEX [1] improves upon the DIRINT model by taking into account
1336
+ DIRINDEX [1] improves upon the DIRINT model by taking into account
1315
1337
turbidity when used with the Ineichen clear sky model results.
1316
1338
1317
1339
Parameters
@@ -1374,7 +1396,7 @@ def dirindex(ghi, ghi_clearsky, dni_clearsky, zenith, times, pressure=101325.,
1374
1396
use_delta_kt_prime = use_delta_kt_prime ,
1375
1397
temp_dew = temp_dew )
1376
1398
1377
- dni_dirint_clearsky = dirint (ghi_clearsky , zenith , times ,
1399
+ dni_dirint_clearsky = dirint (ghi_clearsky , zenith , times ,
1378
1400
pressure = pressure ,
1379
1401
use_delta_kt_prime = use_delta_kt_prime ,
1380
1402
temp_dew = temp_dew )
0 commit comments