From a293bdae14f2fa193a365bd0b37a6f488ce538cb Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Thu, 19 Mar 2020 15:52:12 -0600 Subject: [PATCH 1/6] add temperature.sapm_cell_to_module --- docs/sphinx/source/api.rst | 1 + docs/sphinx/source/whatsnew/v0.7.2.rst | 4 +- pvlib/temperature.py | 73 ++++++++++++++++++++++++-- pvlib/tests/test_temperature.py | 6 +++ 4 files changed, 80 insertions(+), 4 deletions(-) diff --git a/docs/sphinx/source/api.rst b/docs/sphinx/source/api.rst index defe3e97a9..1ae87a8806 100644 --- a/docs/sphinx/source/api.rst +++ b/docs/sphinx/source/api.rst @@ -232,6 +232,7 @@ PV temperature models temperature.sapm_cell temperature.sapm_module + temperature.sapm_cell_from_module temperature.pvsyst_cell temperature.faiman diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 2eda805c1e..4e40cf83ae 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -20,8 +20,10 @@ Enhancements ``temperature_model='faiman'`` option to :py:class:`~pvlib.modelchain.ModelChain` (:pull:`897`) (:issue:`836`). * Add Kimber soiling model :py:func:`pvlib.losses.soiling_kimber`. (:pull:`860`) -* Add :func:`~pvlib.iotools.read_pvgis_tmy` for files downloaded using the +* Add :py:func:`~pvlib.iotools.read_pvgis_tmy` for files downloaded using the PVGIS tool. (:issue:`880`) +* Add :py:func:`~pvlib.temperature.sapm_cell_from_module` to convert back-of- + module temperature to cell temperature (:issue:`927`) Bug fixes ~~~~~~~~~ diff --git a/pvlib/temperature.py b/pvlib/temperature.py index c12e8ba8d2..6972ec8b10 100644 --- a/pvlib/temperature.py +++ b/pvlib/temperature.py @@ -33,7 +33,7 @@ def _temperature_model_params(model, parameter_set): def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT, irrad_ref=1000): r''' - Calculate cell temperature per the Sandia PV Array Performance Model. + Calculate cell temperature per the Sandia Array Performance Model. See [1]_ for details on the Sandia Array Performance Model. @@ -116,12 +116,13 @@ def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT, ''' module_temperature = sapm_module(poa_global, temp_air, wind_speed, a, b) - return module_temperature + (poa_global / irrad_ref) * deltaT + return sapm_cell_from_module(module_temperature, poa_global, deltaT, + irrad_ref) def sapm_module(poa_global, temp_air, wind_speed, a, b): r''' - Calculate module back surface temperature per the Sandia PV Array + Calculate module back surface temperature per the Sandia Array Performance Model. See [1]_ for details on the Sandia Array Performance Model. @@ -186,6 +187,72 @@ def sapm_module(poa_global, temp_air, wind_speed, a, b): return poa_global * np.exp(a + b * wind_speed) + temp_air +def sapm_cell_from_module(module_temperature, poa_global, deltaT, + irrad_ref=1000): + r''' + Calculate cell temperature from module temperature using the Sandia Array + Performance Model. + + See [1]_ for details on the Sandia Array Performance Model. + + Parameters + ---------- + module_temperature : numeric + Temperature of back of module surface [C]. + + poa_global : numeric + Total incident irradiance [W/m^2]. + + deltaT : float + Parameter :math:`\Delta T` in :eq:`sapm2` [C]. + + irrad_ref : float, default 1000 + Reference irradiance, parameter :math:`E_{0}` in + :eq:`sapm2` [W/m^2]. + + Returns + ------- + numeric, values in degrees C. + + Notes + ----- + The model for cell temperature :math:`T_{C}` is given by Eq. 12 in [1]_. + + .. math:: + :label: sapm2 + + T_{C} = T_{m} + \frac{E}{E_{0}} \Delta T + + The module back surface temperature :math:`T_{m}` is implemented in + :py:func:`~pvlib.temperature.sapm_module`. + + Model parameters depend both on + the module construction and its mounting. Parameter sets are provided in + [1]_ for representative modules and mounting, and are coded for convenience + in ``pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS``. + + +---------------+----------------+-------+---------+---------------------+ + | Module | Mounting | a | b | :math:`\Delta T [C]`| + +===============+================+=======+=========+=====================+ + | glass/glass | open rack | -3.47 | -0.0594 | 3 | + +---------------+----------------+-------+---------+---------------------+ + | glass/glass | close roof | -2.98 | -0.0471 | 1 | + +---------------+----------------+-------+---------+---------------------+ + | glass/polymer | open rack | -3.56 | -0.075 | 3 | + +---------------+----------------+-------+---------+---------------------+ + | glass/polymer | insulated back | -2.81 | -0.0455 | 0 | + +---------------+----------------+-------+---------+---------------------+ + + References + ---------- + .. [1] King, D. et al, 2004, "Sandia Photovoltaic Array Performance + Model", SAND Report 3535, Sandia National Laboratories, Albuquerque, + NM. + + ''' + return module_temperature + (poa_global / irrad_ref) * deltaT + + def pvsyst_cell(poa_global, temp_air, wind_speed=1.0, u_c=29.0, u_v=0.0, eta_m=0.1, alpha_absorption=0.9): r""" diff --git a/pvlib/tests/test_temperature.py b/pvlib/tests/test_temperature.py index 7027c979a0..417e24e5eb 100644 --- a/pvlib/tests/test_temperature.py +++ b/pvlib/tests/test_temperature.py @@ -26,6 +26,12 @@ def test_sapm_module(sapm_default): assert_allclose(default, 40.809, 3) +def test_sapm_cell_from_module(sapm_default): + default = temperature.sapm_cell_from_module(50, 900, + sapm_default['deltaT']) + assert_allclose(default, 50 + 900 / 1000 * sapm_default['deltaT']) + + def test_sapm_ndarray(sapm_default): temps = np.array([0, 10, 5]) irrads = np.array([0, 500, 0]) From ba1813a21d73b7034194c3bb1a34d279047eb0aa Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Fri, 20 Mar 2020 08:54:42 -0600 Subject: [PATCH 2/6] add See also to docstring --- pvlib/temperature.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pvlib/temperature.py b/pvlib/temperature.py index 6972ec8b10..7f7172245a 100644 --- a/pvlib/temperature.py +++ b/pvlib/temperature.py @@ -107,6 +107,11 @@ def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT, Model", SAND Report 3535, Sandia National Laboratories, Albuquerque, NM. + See also + -------- + sapm_cell_from_module + sapm_module + Examples -------- >>> from pvlib.temperature import sapm_cell, TEMPERATURE_MODEL_PARAMETERS @@ -183,6 +188,10 @@ def sapm_module(poa_global, temp_air, wind_speed, a, b): Model", SAND Report 3535, Sandia National Laboratories, Albuquerque, NM. + See also + -------- + sapm_cell + sapm_cell_from_module ''' return poa_global * np.exp(a + b * wind_speed) + temp_air @@ -249,6 +258,10 @@ def sapm_cell_from_module(module_temperature, poa_global, deltaT, Model", SAND Report 3535, Sandia National Laboratories, Albuquerque, NM. + See also + -------- + sapm_cell + sapm_module ''' return module_temperature + (poa_global / irrad_ref) * deltaT From 6cc423d3c0c082183f64cd214c95f9fff593005b Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Mon, 23 Mar 2020 09:19:22 -0600 Subject: [PATCH 3/6] Update pvlib/temperature.py Co-Authored-By: Will Holmgren --- pvlib/temperature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/temperature.py b/pvlib/temperature.py index 7f7172245a..e63cd7306b 100644 --- a/pvlib/temperature.py +++ b/pvlib/temperature.py @@ -33,7 +33,7 @@ def _temperature_model_params(model, parameter_set): def sapm_cell(poa_global, temp_air, wind_speed, a, b, deltaT, irrad_ref=1000): r''' - Calculate cell temperature per the Sandia Array Performance Model. + Calculate cell temperature per the Sandia Array Performance Model. See [1]_ for details on the Sandia Array Performance Model. From f1d2a57fabea0cf7de31a6436c152b3815c8fd24 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Mon, 23 Mar 2020 09:24:39 -0600 Subject: [PATCH 4/6] line breaks --- pvlib/temperature.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pvlib/temperature.py b/pvlib/temperature.py index 7f7172245a..4085853ec6 100644 --- a/pvlib/temperature.py +++ b/pvlib/temperature.py @@ -235,10 +235,10 @@ def sapm_cell_from_module(module_temperature, poa_global, deltaT, The module back surface temperature :math:`T_{m}` is implemented in :py:func:`~pvlib.temperature.sapm_module`. - Model parameters depend both on - the module construction and its mounting. Parameter sets are provided in - [1]_ for representative modules and mounting, and are coded for convenience - in ``pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS``. + Model parameters depend both on the module construction and its mounting. + Parameter sets are provided in [1]_ for representative modules and + mounting, and are coded for convenience in + ``pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS``. +---------------+----------------+-------+---------+---------------------+ | Module | Mounting | a | b | :math:`\Delta T [C]`| From 3b03526d4b6f27d59de3fa602bb4b27b1bdf0c26 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Mon, 6 Apr 2020 10:12:45 -0600 Subject: [PATCH 5/6] remove hyphen --- docs/sphinx/source/whatsnew/v0.7.2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 19b0d92ad4..52a634bd40 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -22,7 +22,7 @@ Enhancements * Add Kimber soiling model :py:func:`pvlib.losses.soiling_kimber`. (:pull:`860`) * Add :py:func:`~pvlib.iotools.read_pvgis_tmy` for files downloaded using the PVGIS tool. (:issue:`880`) -* Add :py:func:`~pvlib.temperature.sapm_cell_from_module` to convert back-of- +* Add :py:func:`~pvlib.temperature.sapm_cell_from_module` to convert back of module temperature to cell temperature (:issue:`927`) * Add new module :py:mod:`pvlib.snow` to contain models related to snow coverage and effects on a PV system. (:pull:`764`) * Add snow coverage model :py:func:`pvlib.snow.coverage_nrel` and function to identify when modules are fully covered by snow :py:func:`pvlib.snow.fully_covered_nrel`. (:issue:`577`) From f620d7fb55b91651073d8061b6d0fda989e80336 Mon Sep 17 00:00:00 2001 From: Cliff Hansen Date: Mon, 6 Apr 2020 11:01:56 -0600 Subject: [PATCH 6/6] remove ~ from function paths --- docs/sphinx/source/whatsnew/v0.7.2.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 52a634bd40..b2362a23a5 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -16,13 +16,13 @@ Enhancements * TMY3 dataframe returned by :py:func:`~pvlib.iotools.read_tmy3` now contains the original ``Date (MM/DD/YYYY)`` and ``Time (HH:MM)`` columns that the indices were parsed from. (:pull:`866`) -* Add :py:func:`~pvlib.pvsystem.PVSystem.faiman` and added +* Add :py:func:`pvlib.pvsystem.PVSystem.faiman` and added ``temperature_model='faiman'`` option to :py:class:`~pvlib.modelchain.ModelChain` (:pull:`897`) (:issue:`836`). * Add Kimber soiling model :py:func:`pvlib.losses.soiling_kimber`. (:pull:`860`) -* Add :py:func:`~pvlib.iotools.read_pvgis_tmy` for files downloaded using the +* Add :py:func:`pvlib.iotools.read_pvgis_tmy` for files downloaded using the PVGIS tool. (:issue:`880`) -* Add :py:func:`~pvlib.temperature.sapm_cell_from_module` to convert back of +* Add :py:func:`pvlib.temperature.sapm_cell_from_module` to convert back of module temperature to cell temperature (:issue:`927`) * Add new module :py:mod:`pvlib.snow` to contain models related to snow coverage and effects on a PV system. (:pull:`764`) * Add snow coverage model :py:func:`pvlib.snow.coverage_nrel` and function to identify when modules are fully covered by snow :py:func:`pvlib.snow.fully_covered_nrel`. (:issue:`577`)