Skip to content

Commit 77ac247

Browse files
kandersolarcwhanse
andauthored
Add Array.get_cell_temperature, PVSystem.get_cell_temperature (#1211)
* add Array.get_cell_temperature and PVSystem.get_cell_temperature, deprecate old PVSystem tcell methods, update ModelChain._set_celltemp * fix tests * api.rst * whatsnew * add test for invalid model string * stickler, docs * nudge to trigger CI * fix whatsnew * docstring fix * try out kinder error messages * fixing bugs * test for nice error message * Update pvlib/pvsystem.py Co-authored-by: Cliff Hansen <[email protected]> * stickler * Update pvlib/modelchain.py Co-authored-by: Cliff Hansen <[email protected]> * move _build_args to pvlib.tools * remove deprecated items from api.rst * def -> partial * docstring edits * see also fixes * remove kwarg nonsense Co-authored-by: Cliff Hansen <[email protected]>
1 parent 7661b05 commit 77ac247

File tree

7 files changed

+354
-237
lines changed

7 files changed

+354
-237
lines changed

docs/sphinx/source/api.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,7 @@ PV temperature models
239239
temperature.fuentes
240240
temperature.ross
241241
temperature.noct_sam
242-
pvsystem.PVSystem.sapm_celltemp
243-
pvsystem.PVSystem.pvsyst_celltemp
244-
pvsystem.PVSystem.faiman_celltemp
245-
pvsystem.PVSystem.fuentes_celltemp
246-
pvsystem.PVSystem.noct_sam_celltemp
242+
pvsystem.PVSystem.get_cell_temperature
247243

248244
Temperature Model Parameters
249245
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

docs/sphinx/source/whatsnew/v0.9.0.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ Deprecations
7171
* ``ModelChain.weather``
7272
* ``ModelChain.times``
7373

74+
* The following ``PVSystem`` cell temperature methods have been deprecated
75+
and consolidated into the new wrapper method
76+
:py:meth:`~pvlib.pvsystem.PVSystem.get_cell_temperature` (:pull:`1211`):
77+
78+
* :py:meth:`~pvlib.pvsystem.PVSystem.sapm_celltemp`
79+
* :py:meth:`~pvlib.pvsystem.PVSystem.pvsyst_celltemp`
80+
* :py:meth:`~pvlib.pvsystem.PVSystem.faiman_celltemp`
81+
* :py:meth:`~pvlib.pvsystem.PVSystem.fuentes_celltemp`
82+
* :py:meth:`~pvlib.pvsystem.PVSystem.noct_sam_celltemp`
83+
7484
* The ``eta_m`` parameter for :py:func:`~pvlib.temperature.pvsyst_cell` is
7585
replaced by parameter ``module_efficiency``. (:issue:`1188`, :pull:`1218`)
7686

pvlib/modelchain.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,10 @@ def _set_celltemp(self, model):
992992
993993
Parameters
994994
----------
995-
model : function
996-
A function that takes POA irradiance, air temperature, and
997-
wind speed and returns cell temperature. `model` must accept
998-
tuples or single values for each parameter where each element of
999-
the tuple is the value for a different array in the system
1000-
(see :py:class:`pvlib.pvsystem.PVSystem` for more information).
995+
model : str
996+
A cell temperature model name to pass to
997+
:py:meth:`pvlib.pvsystem.PVSystem.get_cell_temperature`.
998+
Valid names are 'sapm', 'pvsyst', 'faiman', 'fuentes', 'noct_sam'
1001999
10021000
Returns
10031001
-------
@@ -1009,26 +1007,26 @@ def _set_celltemp(self, model):
10091007
temp_air = _tuple_from_dfs(self.results.weather, 'temp_air')
10101008
wind_speed = _tuple_from_dfs(self.results.weather, 'wind_speed')
10111009
kwargs = {}
1012-
if model == self.system.noct_sam_celltemp:
1010+
if model == 'noct_sam':
10131011
kwargs['effective_irradiance'] = self.results.effective_irradiance
1014-
self.results.cell_temperature = model(poa, temp_air, wind_speed,
1015-
**kwargs)
1012+
self.results.cell_temperature = self.system.get_cell_temperature(
1013+
poa, temp_air, wind_speed, model=model, **kwargs)
10161014
return self
10171015

10181016
def sapm_temp(self):
1019-
return self._set_celltemp(self.system.sapm_celltemp)
1017+
return self._set_celltemp('sapm')
10201018

10211019
def pvsyst_temp(self):
1022-
return self._set_celltemp(self.system.pvsyst_celltemp)
1020+
return self._set_celltemp('pvsyst')
10231021

10241022
def faiman_temp(self):
1025-
return self._set_celltemp(self.system.faiman_celltemp)
1023+
return self._set_celltemp('faiman')
10261024

10271025
def fuentes_temp(self):
1028-
return self._set_celltemp(self.system.fuentes_celltemp)
1026+
return self._set_celltemp('fuentes')
10291027

10301028
def noct_sam_temp(self):
1031-
return self._set_celltemp(self.system.noct_sam_celltemp)
1029+
return self._set_celltemp('noct_sam')
10321030

10331031
@property
10341032
def dc_ohmic_model(self):

0 commit comments

Comments
 (0)