Skip to content

Add Array.get_cell_temperature, PVSystem.get_cell_temperature #1211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions docs/sphinx/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,7 @@ PV temperature models
temperature.fuentes
temperature.ross
temperature.noct_sam
pvsystem.PVSystem.sapm_celltemp
pvsystem.PVSystem.pvsyst_celltemp
pvsystem.PVSystem.faiman_celltemp
pvsystem.PVSystem.fuentes_celltemp
pvsystem.PVSystem.noct_sam_celltemp
pvsystem.PVSystem.get_cell_temperature

Temperature Model Parameters
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
10 changes: 10 additions & 0 deletions docs/sphinx/source/whatsnew/v0.9.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ Deprecations
* ``ModelChain.weather``
* ``ModelChain.times``

* The following ``PVSystem`` cell temperature methods have been deprecated
and consolidated into the new wrapper method
:py:meth:`~pvlib.pvsystem.PVSystem.get_cell_temperature` (:pull:`1211`):

* :py:meth:`~pvlib.pvsystem.PVSystem.sapm_celltemp`
* :py:meth:`~pvlib.pvsystem.PVSystem.pvsyst_celltemp`
* :py:meth:`~pvlib.pvsystem.PVSystem.faiman_celltemp`
* :py:meth:`~pvlib.pvsystem.PVSystem.fuentes_celltemp`
* :py:meth:`~pvlib.pvsystem.PVSystem.noct_sam_celltemp`

* The ``eta_m`` parameter for :py:func:`~pvlib.temperature.pvsyst_cell` is
replaced by parameter ``module_efficiency``. (:issue:`1188`, :pull:`1218`)

Expand Down
26 changes: 12 additions & 14 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,12 +992,10 @@ def _set_celltemp(self, model):

Parameters
----------
model : function
A function that takes POA irradiance, air temperature, and
wind speed and returns cell temperature. `model` must accept
tuples or single values for each parameter where each element of
the tuple is the value for a different array in the system
(see :py:class:`pvlib.pvsystem.PVSystem` for more information).
model : str
A cell temperature model name to pass to
:py:meth:`pvlib.pvsystem.PVSystem.get_cell_temperature`.
Valid names are 'sapm', 'pvsyst', 'faiman', 'fuentes', 'noct_sam'

Returns
-------
Expand All @@ -1009,26 +1007,26 @@ def _set_celltemp(self, model):
temp_air = _tuple_from_dfs(self.results.weather, 'temp_air')
wind_speed = _tuple_from_dfs(self.results.weather, 'wind_speed')
kwargs = {}
if model == self.system.noct_sam_celltemp:
if model == 'noct_sam':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring says that model is a function, it's changed to be a string here and elsewhere.

With this change, is ModelChain.temperature_model needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, is ModelChain.temperature_model needed?

I think this question remains, but it should be explored in a separate issue.

kwargs['effective_irradiance'] = self.results.effective_irradiance
self.results.cell_temperature = model(poa, temp_air, wind_speed,
**kwargs)
self.results.cell_temperature = self.system.get_cell_temperature(
poa, temp_air, wind_speed, model=model, **kwargs)
return self

def sapm_temp(self):
return self._set_celltemp(self.system.sapm_celltemp)
return self._set_celltemp('sapm')

def pvsyst_temp(self):
return self._set_celltemp(self.system.pvsyst_celltemp)
return self._set_celltemp('pvsyst')

def faiman_temp(self):
return self._set_celltemp(self.system.faiman_celltemp)
return self._set_celltemp('faiman')

def fuentes_temp(self):
return self._set_celltemp(self.system.fuentes_celltemp)
return self._set_celltemp('fuentes')

def noct_sam_temp(self):
return self._set_celltemp(self.system.noct_sam_celltemp)
return self._set_celltemp('noct_sam')

@property
def dc_ohmic_model(self):
Expand Down
Loading