Skip to content

Commit aa52f5f

Browse files
committed
fix #105, add poa_diffuse
1 parent 04f477f commit aa52f5f

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

pvlib/irradiance.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ def beam_component(surface_tilt, surface_azimuth,
315315

316316
# ToDo: how to best structure this function? wholmgren 2014-11-03
317317
def total_irrad(surface_tilt, surface_azimuth,
318-
solar_zenith, solar_azimuth,
318+
apparent_zenith, azimuth,
319319
dni, ghi, dhi, dni_extra=None, airmass=None,
320320
albedo=.25, surface_type=None,
321321
model='isotropic',
322-
model_perez='allsitescomposite1990'):
322+
model_perez='allsitescomposite1990', **kwargs):
323323
'''
324324
Determine diffuse irradiance from the sky on a
325325
tilted surface.
@@ -359,7 +359,8 @@ def total_irrad(surface_tilt, surface_azimuth,
359359
360360
Returns
361361
-------
362-
DataFrame with columns ``'total', 'beam', 'sky', 'ground'``.
362+
DataFrame with columns ``'poa_global', 'poa_direct',
363+
'poa_sky_diffuse', 'poa_ground_diffuse'``.
363364
364365
References
365366
----------
@@ -370,6 +371,9 @@ def total_irrad(surface_tilt, surface_azimuth,
370371

371372
pvl_logger.debug('planeofarray.total_irrad()')
372373

374+
solar_zenith = apparent_zenith
375+
solar_azimuth = azimuth
376+
373377
beam = beam_component(surface_tilt, surface_azimuth,
374378
solar_zenith, solar_azimuth, dni)
375379

@@ -396,12 +400,15 @@ def total_irrad(surface_tilt, surface_azimuth,
396400

397401
ground = grounddiffuse(surface_tilt, ghi, albedo, surface_type)
398402

399-
total = beam + sky + ground
403+
diffuse = sky + ground
404+
total = beam + diffuse
400405

401-
all_irrad = pd.DataFrame({'total': total,
402-
'beam': beam,
403-
'sky': sky,
404-
'ground': ground})
406+
all_irrad = pd.DataFrame()
407+
all_irrad['poa_global'] = total
408+
all_irrad['poa_direct'] = beam
409+
all_irrad['poa_diffuse'] = diffuse
410+
all_irrad['poa_sky_diffuse'] = sky
411+
all_irrad['poa_ground_diffuse'] = ground
405412

406413
return all_irrad
407414

pvlib/test/test_irradiance.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ def test_total_irrad():
159159
dni_extra=dni_et, airmass=AM,
160160
model=model,
161161
surface_type='urban')
162+
163+
assert total.columns.tolist() == ['poa_global', 'poa_direct',
164+
'poa_diffuse', 'poa_sky_diffuse',
165+
'poa_ground_diffuse']
162166

163167

164168
def test_globalinplane():

0 commit comments

Comments
 (0)