Skip to content

Commit a536cb2

Browse files
committed
Defines ir_down as weather variable Within faiman_rad.
1 parent 6f5bc0d commit a536cb2

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

pvlib/pvsystem.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def get_iam(self, aoi, iam_model='physical'):
414414

415415
@_unwrap_single_value
416416
def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
417-
effective_irradiance=None):
417+
effective_irradiance=None, ir_down=None):
418418
"""
419419
Determine cell temperature using the method specified by ``model``.
420420
@@ -437,6 +437,10 @@ def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
437437
effective_irradiance : numeric or tuple of numeric, optional
438438
The irradiance that is converted to photocurrent in W/m^2.
439439
Only used for some models.
440+
441+
ir_down: numeric, optional
442+
Downwelling infrared radiation from the sky, measured on a
443+
horizontal surface in W/m^2. Only used in ``'faiman_rad'`` model.
440444
441445
Returns
442446
-------
@@ -460,14 +464,16 @@ def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
460464
# Not used for all models, but Array.get_cell_temperature handles it
461465
effective_irradiance = self._validate_per_array(effective_irradiance,
462466
system_wide=True)
467+
ir_down = self._validate_per_array(ir_down, system_wide=True)
463468

464469
return tuple(
465470
array.get_cell_temperature(poa_global, temp_air, wind_speed,
466-
model, effective_irradiance)
467-
for array, poa_global, temp_air, wind_speed, effective_irradiance
471+
model, effective_irradiance, ir_down)
472+
for array, poa_global, temp_air, wind_speed, effective_irradiance,
473+
ir_down
468474
in zip(
469475
self.arrays, poa_global, temp_air, wind_speed,
470-
effective_irradiance
476+
effective_irradiance, ir_down
471477
)
472478
)
473479

@@ -1205,7 +1211,7 @@ def get_iam(self, aoi, iam_model='physical'):
12051211
raise ValueError(model + ' is not a valid IAM model')
12061212

12071213
def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
1208-
effective_irradiance=None):
1214+
effective_irradiance=None, ir_down=None):
12091215
"""
12101216
Determine cell temperature using the method specified by ``model``.
12111217
@@ -1229,6 +1235,10 @@ def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
12291235
The irradiance that is converted to photocurrent in W/m^2.
12301236
Only used for some models.
12311237
1238+
ir_down: numeric, optional
1239+
Downwelling infrared radiation from the sky, measured on a
1240+
horizontal surface in W/m^2. Only used in ``'faiman_rad'`` model.
1241+
12321242
Returns
12331243
-------
12341244
numeric
@@ -1271,7 +1281,8 @@ def get_cell_temperature(self, poa_global, temp_air, wind_speed, model,
12711281
optional = _build_kwargs(['u0', 'u1'],
12721282
self.temperature_model_parameters)
12731283
elif model == 'faiman_rad':
1274-
func = temperature.faiman_rad
1284+
func = functools.partial(temperature.faiman_rad,
1285+
ir_down=ir_down)
12751286
required = ()
12761287
optional = _build_kwargs(['ir_down', 'u0', 'u1',
12771288
'sky_view', 'emissivity'],

tests/test_pvsystem.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,15 @@ def test_PVSystem_faiman_rad_celltemp(mocker):
502502
sky_view = 1.0
503503
emissivity = 0.88
504504

505-
temp_model_params = {'ir_down': ir_down, 'u0': u0, 'u1': u1,
506-
'sky_view': sky_view, 'emissivity': emissivity}
505+
temp_model_params = {'u0': u0, 'u1': u1, 'sky_view': sky_view,
506+
'emissivity': emissivity}
507507
system = pvsystem.PVSystem(temperature_model_parameters=temp_model_params)
508508
mocker.spy(temperature, 'faiman_rad')
509509
temps = 25
510510
irrads = 1000
511511
winds = 1
512-
out = system.get_cell_temperature(irrads, temps, winds, model='faiman_rad')
512+
out = system.get_cell_temperature(irrads, temps, winds, ir_down,
513+
model='faiman_rad')
513514
temperature.faiman_rad.assert_called_once_with(irrads, temps, winds,
514515
ir_down, u0, u1,
515516
sky_view, emissivity)

0 commit comments

Comments
 (0)