8000 add get_aoi, dni/am calcs · dacoex/pvlib-python@c541abd · GitHub
[go: up one dir, main page]

Skip to content

Commit c541abd

Browse files
committed
add get_aoi, dni/am calcs
1 parent 7d49393 commit c541abd

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

pvlib/pvsystem.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from pvlib import tools
2121
from pvlib.location import Location
22-
from pvlib import irradiance
22+
from pvlib import irradiance, atmosphere
2323

2424

2525
# not sure if this belongs in the pvsystem module.
@@ -99,7 +99,7 @@ def __init__(self,
9999
module=None, module_parameters=None,
100100
series_modules=None, parallel_modules=None,
101101
inverter=None, inverter_parameters=None,
102-
racking_model=None,
102+
racking_model='open_rack_cell_glassback',
103103
**kwargs):
104104

105105
self.surface_tilt = surface_tilt
@@ -128,6 +128,27 @@ def __init__(self,
128128
super(PVSystem, self).__init__(**kwargs)
129129

130130

131+
def get_aoi(self, solar_zenith, solar_azimuth):
132+
"""Get the angle of incidence on the system.
133+
134+
Parameters
135+
----------
136+
solar_zenith : float or Series.
137+
Solar zenith angle.
138+
solar_azimuth : float or Series.
139+
Solar azimuth angle.
140+
141+
Returns
142+
-------
143+
aoi : Series
144+
The angle of incidence
145+
"""
146+
147+
aoi = irradiance.aoi(self.surface_tilt, self.surface_azimuth,
148+
solar_ze B290 nith, solar_azimuth)
149+
return aoi
150+
151+
131152
def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
132153
dni_extra=None, airmass=None, model='isotropic',
133154
**kwargs):
@@ -166,6 +187,14 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
166187
Column names are: ``total, beam, sky, ground``.
167188
"""
168189

190+
# not needed for all models, but this is easier
191+
if dni_extra is None:
192+
dni_extra = irradiance.extraradiation(solar_zenith.index)
193+
dni_extra = pd.Series(dni_extra, index=solar_zenith.index)
194+
195+
if airmass is None:
196+
airmass = atmosphere.relativeairmass(solar_zenith)
197+
169198
return irradiance.total_irrad(self.surface_tilt,
170199
self.surface_azimuth,
171200
solar_zenith, solar_azimuth,

0 commit comments

Comments
 (0)
0