From f3df94fa12f6bcf5d3c3cc7a684849d6ede244ef Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:52:34 +0100 Subject: [PATCH 01/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 56 ++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index d2fc4dcf1d..2f120a45b1 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -531,26 +531,66 @@ def spectral_factor_firstsolar(precipitable_water, airmass_absolute, def spectral_factor_sapm(airmass_absolute, module): """ - Calculates the SAPM spectral loss coefficient, F1. + Calculates a module-specific SAPM spectral loss coefficient, :math:`f_1`, + equivalent to the spectral mismatch factor, using absolute + (pressure-corrected) air mass, :math:`AM_a`. + + The SAPM spetral factor function is part of the broader Sandia Array + Performance Model, which defines five points on an IV curve using empirical + module-specific coefficients. Module coefficients for the SAPM are + available in the SAPM database and can be retrieved for use in the + ``module`` parameter through + :pyfunc:`pv.pvsystem.retrieve_sam('SandiaMod')`. More details on the SAPM + can be found in [1]_, while a full description of the procedure to + determine the empirical model coefficients, including those for the SAPM + spectral correction, can be found in [2]_. Parameters ---------- airmass_absolute : numeric - Absolute airmass + Absolute airmass [unitless] + Note: `np.nan` airmass values will result in 0 output. module : dict-like - A dict, Series, or DataFrame defining the SAPM performance - parameters. See the :py:func:`sapm` notes section for more - details. + A dict, Series, or DataFrame defining the SAPM performance parameters + See the :py:func:`pvlib.pvsystem.sapm` notes section for more details. Returns ------- - F1 : numeric + :math:`f_1` : numeric The SAPM spectral loss coefficient. + References + ---------- + .. [1] King, D., Kratochvil, J., and Boyson W. (2004), "Sandia + Photovoltaic Array Performance Model", (No. SAND2004-3535), Sandia + National Laboratories, Albuquerque, NM (United States). + :doi:`10.2172/919131` + .. [2] King, B., Hansen, C., Riley, D., Robinson, C.,and& Pratt, L. + (2016). Procedure to determine coefficients for the Sandia Array + Performance Model (SAPM) (No. SAND2016-5284). Sandia National + Laboratories, Albuquerque, NM (United States). + :doi:`10.2172/1256510` + .. [3] King, D., Kratochvil, J., and Boyson, W. "Measuring solar spectral + and angle-of-incidence effects on photovoltaic modules and solar + irradiance sensors." Conference Record of the 26th IEEE Potovoltaic + Specialists Conference (PVSC). IEEE, 1997. + :doi:`10.1109/PVSC.1997.654283` + Notes ----- - nan airmass values will result in 0 output. + The SAPM spectral correction functions parameterises :math:`f_1` as a + fourth order polynomial function of absolute air mass: + + .. math:: + + f_1 = A_0 + A_1 AM_a + A_2 AM_a^2 + A_3 AM_a^3 + A_4 AM_a^4, + + where :math:`f_1` is the spectral correction factor, :math:A_{0-4} are the + module-specific coefficients, and :math:`AM_a` is the absolute airmass, + which is calculated by applying a pressure correction to the relative + airmass. More detail on how this spectral correction function was developed + can be found in [3]_. """ am_coeff = [module['A4'], module['A3'], module['A2'], module['A1'], @@ -581,7 +621,7 @@ def spectral_factor_caballero(precipitable_water, airmass_absolute, aod500, available here via the ``module_type`` parameter were determined by fitting the model equations to spectral factors calculated from global tilted spectral irradiance measurements taken in the city of - Jaén, Spain. See [1]_ for details. + Jaén, Spain. See [1]_ for details. Parameters ---------- From b3cd7e871e94432276c8c9cd13a901de40e5d890 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:22:31 +0100 Subject: [PATCH 02/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 2f120a45b1..16a7ec06cb 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -540,8 +540,8 @@ def spectral_factor_sapm(airmass_absolute, module): module-specific coefficients. Module coefficients for the SAPM are available in the SAPM database and can be retrieved for use in the ``module`` parameter through - :pyfunc:`pv.pvsystem.retrieve_sam('SandiaMod')`. More details on the SAPM - can be found in [1]_, while a full description of the procedure to + :pyfunc:`pvlib.pvsystem.retrieve_sam('SandiaMod')`. More details on the + SAPM can be found in [1]_, while a full description of the procedure to determine the empirical model coefficients, including those for the SAPM spectral correction, can be found in [2]_. @@ -560,6 +560,21 @@ def spectral_factor_sapm(airmass_absolute, module): :math:`f_1` : numeric The SAPM spectral loss coefficient. + Notes + ----- + The SAPM spectral correction functions parameterises :math:`f_1` as a + fourth order polynomial function of absolute air mass: + + .. math:: + + f_1 = A_0 + A_1 AM_a + A_2 AM_a^2 + A_3 AM_a^3 + A_4 AM_a^4, + + where :math:`f_1` is the spectral correction factor, :math:A_{0-4} are the + module-specific coefficients, and :math:`AM_a` is the absolute airmass, + which is calculated by applying a pressure correction to the relative + airmass. More detail on how this spectral correction function was developed + can be found in [3]_. + References ---------- .. [1] King, D., Kratochvil, J., and Boyson W. (2004), "Sandia @@ -577,20 +592,6 @@ def spectral_factor_sapm(airmass_absolute, module): Specialists Conference (PVSC). IEEE, 1997. :doi:`10.1109/PVSC.1997.654283` - Notes - ----- - The SAPM spectral correction functions parameterises :math:`f_1` as a - fourth order polynomial function of absolute air mass: - - .. math:: - - f_1 = A_0 + A_1 AM_a + A_2 AM_a^2 + A_3 AM_a^3 + A_4 AM_a^4, - - where :math:`f_1` is the spectral correction factor, :math:A_{0-4} are the - module-specific coefficients, and :math:`AM_a` is the absolute airmass, - which is calculated by applying a pressure correction to the relative - airmass. More detail on how this spectral correction function was developed - can be found in [3]_. """ am_coeff = [module['A4'], module['A3'], module['A2'], module['A1'], From 9b2066fb3417ae3a98ec77c671b2c445c220a827 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:23:24 +0100 Subject: [PATCH 03/13] Update mismatch.py typo --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 16a7ec06cb..226ff4b8b2 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -581,7 +581,7 @@ def spectral_factor_sapm(airmass_absolute, module): Photovoltaic Array Performance Model", (No. SAND2004-3535), Sandia National Laboratories, Albuquerque, NM (United States). :doi:`10.2172/919131` - .. [2] King, B., Hansen, C., Riley, D., Robinson, C.,and& Pratt, L. + .. [2] King, B., Hansen, C., Riley, D., Robinson, C., and Pratt, L. (2016). Procedure to determine coefficients for the Sandia Array Performance Model (SAPM) (No. SAND2016-5284). Sandia National Laboratories, Albuquerque, NM (United States). From 644b1fa0a633cd7a226b22cfe96dba6d45cdd04a Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 13:32:20 +0100 Subject: [PATCH 04/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 226ff4b8b2..c6853674ef 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -567,10 +567,10 @@ def spectral_factor_sapm(airmass_absolute, module): .. math:: - f_1 = A_0 + A_1 AM_a + A_2 AM_a^2 + A_3 AM_a^3 + A_4 AM_a^4, + f_1 = a_0 + a_1 AM_a + a_2 AM_a^2 + a_3 AM_a^3 + a_4 AM_a^4, - where :math:`f_1` is the spectral correction factor, :math:A_{0-4} are the - module-specific coefficients, and :math:`AM_a` is the absolute airmass, + where :math:`f_1` is the spectral correction factor, :math:`a_{0--4}` are + the module-specific coefficients, and :math:`AM_a` is the absolute airmass, which is calculated by applying a pressure correction to the relative airmass. More detail on how this spectral correction function was developed can be found in [3]_. From 9fea1e5d77c0a43694b0dfd3784f9e6aa8c7f466 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:12:14 +0100 Subject: [PATCH 05/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index c6853674ef..ebbcd50e88 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -540,7 +540,7 @@ def spectral_factor_sapm(airmass_absolute, module): module-specific coefficients. Module coefficients for the SAPM are available in the SAPM database and can be retrieved for use in the ``module`` parameter through - :pyfunc:`pvlib.pvsystem.retrieve_sam('SandiaMod')`. More details on the + :pyfunc:`pvlib.pvsystem.retrieve_sam()`. More details on the SAPM can be found in [1]_, while a full description of the procedure to determine the empirical model coefficients, including those for the SAPM spectral correction, can be found in [2]_. @@ -549,7 +549,7 @@ def spectral_factor_sapm(airmass_absolute, module): ---------- airmass_absolute : numeric Absolute airmass [unitless] - Note: `np.nan` airmass values will result in 0 output. + Note: ``np.nan`` airmass values will result in 0 output. module : dict-like A dict, Series, or DataFrame defining the SAPM performance parameters @@ -569,7 +569,7 @@ def spectral_factor_sapm(airmass_absolute, module): f_1 = a_0 + a_1 AM_a + a_2 AM_a^2 + a_3 AM_a^3 + a_4 AM_a^4, - where :math:`f_1` is the spectral correction factor, :math:`a_{0--4}` are + where :math:`f_1` is the spectral correction factor, :math:`a_{0-4}` are the module-specific coefficients, and :math:`AM_a` is the absolute airmass, which is calculated by applying a pressure correction to the relative airmass. More detail on how this spectral correction function was developed From 6939ecdf172c4e75a4c234bb1d4bcc74bec63fc2 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:26:35 +0100 Subject: [PATCH 06/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index ebbcd50e88..8635001bd6 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -549,6 +549,7 @@ def spectral_factor_sapm(airmass_absolute, module): ---------- airmass_absolute : numeric Absolute airmass [unitless] + Note: ``np.nan`` airmass values will result in 0 output. module : dict-like From 9f34dc33928ace22d77b3a1aa0423fd85d32c0cd Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:55:23 +0100 Subject: [PATCH 07/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Kevin Anderson --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 8635001bd6..ad32d2313c 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -540,7 +540,7 @@ def spectral_factor_sapm(airmass_absolute, module): module-specific coefficients. Module coefficients for the SAPM are available in the SAPM database and can be retrieved for use in the ``module`` parameter through - :pyfunc:`pvlib.pvsystem.retrieve_sam()`. More details on the + :py:func:`pvlib.pvsystem.retrieve_sam()`. More details on the SAPM can be found in [1]_, while a full description of the procedure to determine the empirical model coefficients, including those for the SAPM spectral correction, can be found in [2]_. From 793ec09aebac23a945bb1a1684f633afaea14f10 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:55:32 +0100 Subject: [PATCH 08/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Kevin Anderson --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index ad32d2313c..5c6903426d 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -535,7 +535,7 @@ def spectral_factor_sapm(airmass_absolute, module): equivalent to the spectral mismatch factor, using absolute (pressure-corrected) air mass, :math:`AM_a`. - The SAPM spetral factor function is part of the broader Sandia Array + The SAPM spectral factor function is part of the broader Sandia Array Performance Model, which defines five points on an IV curve using empirical module-specific coefficients. Module coefficients for the SAPM are available in the SAPM database and can be retrieved for use in the From a9e4240d127f47f15c492303a2d8174b9e480aba Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:56:18 +0100 Subject: [PATCH 09/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Kevin Anderson --- pvlib/spectrum/mismatch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 5c6903426d..8ab3667554 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -553,7 +553,8 @@ def spectral_factor_sapm(airmass_absolute, module): Note: ``np.nan`` airmass values will result in 0 output. module : dict-like - A dict, Series, or DataFrame defining the SAPM performance parameters + A dict, Series, or DataFrame defining the SAPM performance parameters. + Must contain keys `'A0'` through `'A4'`. See the :py:func:`pvlib.pvsystem.sapm` notes section for more details. Returns From 7e66023d2e3b18d03de00c6b2c47de14a6064d82 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 14:58:12 +0100 Subject: [PATCH 10/13] Update mismatch.py --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 8635001bd6..26bc5d95ec 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -558,7 +558,7 @@ def spectral_factor_sapm(airmass_absolute, module): Returns ------- - :math:`f_1` : numeric + f1 : numeric The SAPM spectral loss coefficient. Notes From 5554f890c62bb33065d4d5d8d35c6cc3fdbfe08e Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:32:59 +0100 Subject: [PATCH 11/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Cliff Hansen --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index 626d0c7b26..cf9a263901 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -553,7 +553,7 @@ def spectral_factor_sapm(airmass_absolute, module): Note: ``np.nan`` airmass values will result in 0 output. module : dict-like - A dict, Series, or DataFrame defining the SAPM performance parameters. + A dict, Series, or DataFrame defining the SAPM parameters. Must contain keys `'A0'` through `'A4'`. See the :py:func:`pvlib.pvsystem.sapm` notes section for more details. From fddbd9e22dd1c89c73848a97bc98d7b07d714c53 Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:33:16 +0100 Subject: [PATCH 12/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Cliff Hansen --- pvlib/spectrum/mismatch.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index cf9a263901..b5627ec797 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -531,9 +531,8 @@ def spectral_factor_firstsolar(precipitable_water, airmass_absolute, def spectral_factor_sapm(airmass_absolute, module): """ - Calculates a module-specific SAPM spectral loss coefficient, :math:`f_1`, - equivalent to the spectral mismatch factor, using absolute - (pressure-corrected) air mass, :math:`AM_a`. + Calculates the spectral mismatch factor, :math:`f_1`, + using the Sandia Array Performance Model approach. The SAPM spectral factor function is part of the broader Sandia Array Performance Model, which defines five points on an IV curve using empirical From f33b1b2a0188c3b82410d9de458992a5011f9fcb Mon Sep 17 00:00:00 2001 From: RDaxini <143435106+RDaxini@users.noreply.github.com> Date: Wed, 3 Jul 2024 20:33:29 +0100 Subject: [PATCH 13/13] Update pvlib/spectrum/mismatch.py Co-authored-by: Cliff Hansen --- pvlib/spectrum/mismatch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pvlib/spectrum/mismatch.py b/pvlib/spectrum/mismatch.py index b5627ec797..61e0957ff4 100644 --- a/pvlib/spectrum/mismatch.py +++ b/pvlib/spectrum/mismatch.py @@ -570,7 +570,7 @@ def spectral_factor_sapm(airmass_absolute, module): f_1 = a_0 + a_1 AM_a + a_2 AM_a^2 + a_3 AM_a^3 + a_4 AM_a^4, - where :math:`f_1` is the spectral correction factor, :math:`a_{0-4}` are + where :math:`f_1` is the spectral mismatch factor, :math:`a_{0-4}` are the module-specific coefficients, and :math:`AM_a` is the absolute airmass, which is calculated by applying a pressure correction to the relative airmass. More detail on how this spectral correction function was developed