Skip to content

Commit 07ae57e

Browse files
committed
Adapts irradiance.isotropic to return_components framework.
1 parent 62eed1f commit 07ae57e

1 file changed

Lines changed: 32 additions & 7 deletions

File tree

pvlib/irradiance.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def get_ground_diffuse(surface_tilt, ghi, albedo=.25, surface_type=None):
587587
return diffuse_irrad
588588

589589

590-
def isotropic(surface_tilt, dhi):
590+
def isotropic(surface_tilt, dhi, return_components=False):
591591
r'''
592592
Determine diffuse irradiance from the sky on a tilted surface using
593593
the isotropic sky model.
@@ -613,10 +613,23 @@ def isotropic(surface_tilt, dhi):
613613
dhi : numeric
614614
Diffuse horizontal irradiance. [Wm⁻²] DHI must be >=0.
615615
616+
return_components : bool, default False
617+
Flag used to decide whether to return the calculated diffuse components
618+
or not. If `False`, ``sky_diffuse`` is returned. If `True`,
619+
``diffuse_components`` is returned.
620+
616621
Returns
617622
-------
618-
diffuse : numeric
619-
The sky diffuse component of the solar radiation.
623+
poa_sky_diffuse : numeric
624+
The sky diffuse component of the solar radiation on a tilted
625+
surface.
626+
627+
diffuse_components : OrderedDict (array input) or DataFrame (Series input)
628+
Keys/columns are:
629+
* sky_diffuse: Total sky diffuse
630+
* isotropic
631+
* circumsolar
632+
* horizon
620633
621634
References
622635
----------
@@ -630,9 +643,20 @@ def isotropic(surface_tilt, dhi):
630643
Energy vol. 201. pp. 8-12
631644
:doi:`10.1016/j.solener.2020.02.067`
632645
'''
633-
sky_diffuse = dhi * (1 + tools.cosd(surface_tilt)) * 0.5
646+
poa_sky_diffuse = dhi * (1 + tools.cosd(surface_tilt)) * 0.5
634647

635-
return sky_diffuse
648+
if return_components:
649+
diffuse_components = OrderedDict()
650+
diffuse_components['poa_sky_diffuse'] = poa_sky_diffuse
651+
652+
# Calculate the different components
653+
diffuse_components['poa_isotropic'] = poa_sky_diffuse
654+
diffuse_components['poa_circumsolar'] = 0
655+
diffuse_components['poa_horizon'] = 0
656+
657+
return diffuse_components
658+
else:
659+
return poa_sky_diffuse
636660

637661

638662
def klucher(surface_tilt, surface_azimuth, dhi, ghi, solar_zenith,
@@ -782,8 +806,9 @@ def haydavies(surface_tilt, surface_azimuth, dhi, dni, dni_extra,
782806
or supply ``projection_ratio``.
783807
784808
return_components : bool, default `False`
785-
If `False`, ``sky_diffuse`` is returned.
786-
If `True`, ``diffuse_components`` is returned.
809+
Flag used to decide whether to return the calculated diffuse components
810+
or not. If `False`, ``sky_diffuse`` is returned. If `True`,
811+
``diffuse_components`` is returned.
787812
788813
Returns
789814
--------

0 commit comments

Comments
 (0)