|
19 | 19 |
|
20 | 20 | from pvlib import tools
|
21 | 21 | from pvlib.location import Location
|
22 |
| -from pvlib import irradiance |
| 22 | +from pvlib import irradiance, atmosphere |
23 | 23 |
|
24 | 24 |
|
25 | 25 | # not sure if this belongs in the pvsystem module.
|
@@ -99,7 +99,7 @@ def __init__(self,
|
99 | 99 | module=None, module_parameters=None,
|
100 | 100 | series_modules=None, parallel_modules=None,
|
101 | 101 | inverter=None, inverter_parameters=None,
|
102 |
| - racking_model=None, |
| 102 | + racking_model='open_rack_cell_glassback', |
103 | 103 | **kwargs):
|
104 | 104 |
|
105 | 105 | self.surface_tilt = surface_tilt
|
@@ -128,6 +128,27 @@ def __init__(self,
|
128 | 128 | super(PVSystem, self).__init__(**kwargs)
|
129 | 129 |
|
130 | 130 |
|
| 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 | + |
131 | 152 | def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
|
132 | 153 | dni_extra=None, airmass=None, model='isotropic',
|
133 | 154 | **kwargs):
|
@@ -166,6 +187,14 @@ def get_irradiance(self, solar_zenith, solar_azimuth, dni, ghi, dhi,
|
166 | 187 | Column names are: ``total, beam, sky, ground``.
|
167 | 188 | """
|
168 | 189 |
|
| 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 | + |
169 | 198 | return irradiance.total_irrad(self.surface_tilt,
|
170 | 199 | self.surface_azimuth,
|
171 | 200 | solar_zenith, solar_azimuth,
|
|
0 commit comments