|
2 | 2 | import pandas as pd
|
3 | 3 |
|
4 | 4 | from pvlib.tools import cosd, sind, tand
|
5 |
| -from pvlib.pvsystem import PVSystem |
| 5 | +from pvlib.pvsystem import PVSystem, _unwrap_single_value |
6 | 6 | from pvlib import irradiance, atmosphere
|
7 | 7 |
|
8 | 8 |
|
@@ -169,6 +169,7 @@ def get_aoi(self, surface_tilt, surface_azimuth, solar_zenith,
|
169 | 169 | solar_zenith, solar_azimuth)
|
170 | 170 | return aoi
|
171 | 171 |
|
| 172 | + @_unwrap_single_value |
172 | 173 | def get_irradiance(self, surface_tilt, surface_azimuth,
|
173 | 174 | solar_zenith, solar_azimuth, dni, ghi, dhi,
|
174 | 175 | dni_extra=None, airmass=None, model='haydavies',
|
@@ -221,16 +222,29 @@ def get_irradiance(self, surface_tilt, surface_azimuth,
|
221 | 222 | if airmass is None:
|
222 | 223 | airmass = atmosphere.get_relative_airmass(solar_zenith)
|
223 | 224 |
|
224 |
| - return irradiance.get_total_irradiance(surface_tilt, |
225 |
| - surface_azimuth, |
226 |
| - solar_zenith, |
227 |
| - solar_azimuth, |
228 |
| - dni, ghi, dhi, |
229 |
| - dni_extra=dni_extra, |
230 |
| - airmass=airmass, |
231 |
| - model=model, |
232 |
| - albedo=self.albedo, |
233 |
| - **kwargs) |
| 225 | + # SingleAxisTracker only supports a single Array, but we need the |
| 226 | + # validate/iterate machinery so that single length tuple input/output |
| 227 | + # is handled the same as PVSystem.get_irradiance. GH 1159 |
| 228 | + dni = self._validate_per_array(dni, system_wide=True) |
| 229 | + ghi = self._validate_per_array(ghi, system_wide=True) |
| 230 | + dhi = self._validate_per_array(dhi, system_wide=True) |
| 231 | + |
| 232 | + return tuple( |
| 233 | + irradiance.get_total_irradiance( |
| 234 | + surface_tilt, |
| 235 | + surface_azimuth, |
| 236 | + solar_zenith, |
| 237 | + solar_azimuth, |
| 238 | + dni, ghi, dhi, |
| 239 | + dni_extra=dni_extra, |
| 240 | + airmass=airmass, |
| 241 | + model=model, |
| 242 | + albedo=self.albedo, |
| 243 | + **kwargs) |
| 244 | + for array, dni, ghi, dhi in zip( |
| 245 | + self.arrays, dni, ghi, dhi |
| 246 | + ) |
| 247 | + ) |
234 | 248 |
|
235 | 249 |
|
236 | 250 | def singleaxis(apparent_zenith, apparent_azimuth,
|
|
0 commit comments