Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3363ace
Add polo-smm
jesuspolo Jun 25, 2025
ceba758
Apply suggestions from code review
jesuspolo Jun 25, 2025
36c9b43
Update mismatch.py
jesuspolo Jun 25, 2025
eaa90b4
Update mismatch.py
jesuspolo Jun 25, 2025
794ed98
Update mismatch.py
jesuspolo Jun 25, 2025
7926a3d
Update mismatch.py
jesuspolo Jun 25, 2025
988557c
Update mismatch.py
jesuspolo Jul 11, 2025
45e768f
Update mismatch.py
jesuspolo Jul 28, 2025
38e5694
Update pvlib/spectrum/mismatch.py
jesuspolo Jul 28, 2025
c24e013
Update pvlib/spectrum/mismatch.py
jesuspolo Jul 28, 2025
0a00f1b
Changes from code review
AdamRJensen Oct 25, 2025
2a9d0db
Add function to spectrum/__init__.py
AdamRJensen Oct 25, 2025
f296c7b
Update test_mismatch.py
jesuspolo Oct 27, 2025
ce862d8
Update test_mismatch.py
jesuspolo Oct 27, 2025
11336ab
Fix module import in tests
AdamRJensen Oct 27, 2025
e418218
Update test_mismatch.py
jesuspolo Oct 27, 2025
fb0ad0e
Merge branch 'polo-smm' of https://github.com/jesuspolo/pvlib-python …
jesuspolo Oct 27, 2025
450dd37
Fix linter
AdamRJensen Oct 27, 2025
1eb3293
Remove tab character
AdamRJensen Oct 27, 2025
4892e8d
Update test_mismatch.py
jesuspolo Oct 27, 2025
7513f3e
Update test_mismatch.py
jesuspolo Oct 27, 2025
3e4dd56
Update test_mismatch.py
jesuspolo Oct 27, 2025
b9d21ac
fix line legth linter error
AdamRJensen Oct 28, 2025
49c8c91
Update test_mismatch.py
jesuspolo Oct 28, 2025
fa3ff32
Merge branch 'polo-smm' of https://github.com/jesuspolo/pvlib-python …
jesuspolo Oct 28, 2025
31fe508
Update mismatch.py
jesuspolo Oct 29, 2025
c958abf
Update mismatch.py
jesuspolo Nov 14, 2025
bd1ff4f
Apply suggestions from code review
kandersolar Nov 19, 2025
f0a4f34
replace `altitude` parameter with `pressure`
kandersolar Nov 19, 2025
ee7f13f
`albedo : numeric`
kandersolar Nov 19, 2025
82598ec
make albedo coefficients user-specified as well
kandersolar Nov 19, 2025
8b2b7ca
complete tests
kandersolar Nov 19, 2025
31f26b5
docstring cleanup
kandersolar Nov 19, 2025
f4e07de
Merge remote-tracking branch 'upstream/main' into pr/2491
kandersolar Nov 19, 2025
5ec4bee
whatsnew note and contributors
kandersolar Nov 19, 2025
d0efc37
add to user guide SMM model comparison table
kandersolar Nov 19, 2025
297f160
lint
kandersolar Nov 19, 2025
c9b9816
minor doc fixes
kandersolar Nov 19, 2025
3df13ae
Update mismatch.py
jesuspolo Nov 21, 2025
3015b3a
Update mismatch.py
jesuspolo Nov 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ Spectrum
spectrum.calc_spectral_mismatch_field
spectrum.spectral_factor_caballero
spectrum.spectral_factor_firstsolar
spectrum.spectral_factor_sapm
spectrum.spectral_factor_pvspec
spectrum.spectral_factor_jrc
spectrum.spectral_factor_polo
spectrum.spectral_factor_pvspec
spectrum.spectral_factor_sapm
spectrum.sr_to_qe
spectrum.qe_to_sr
spectrum.average_photon_energy
5 changes: 3 additions & 2 deletions pvlib/spectrum/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
calc_spectral_mismatch_field,
spectral_factor_caballero,
spectral_factor_firstsolar,
spectral_factor_sapm,
spectral_factor_pvspec,
spectral_factor_jrc,
spectral_factor_polo,
spectral_factor_pvspec,
spectral_factor_sapm,
)
from pvlib.spectrum.irradiance import ( # noqa: F401
get_reference_spectra,
Expand Down
84 changes: 84 additions & 0 deletions pvlib/spectrum/mismatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,87 @@
+ coeff[2] * (airmass - 1.5)
)
return mismatch


def spectral_factor_polo(precipitable_water, airmass_absolute, aod500, aoi,
altitude, module_type=None, coefficients=None,
albedo=0.2):
"""
Estimate the spectral mismatch for BIPV application in vertical facades.
Parameters
----------
precipitable_water : numeric
atmospheric precipitable water. [cm]
airmass_absolute : numeric
absolute (pressure-adjusted) airmass. See :term:`airmass_absolute`.
[unitless]
aod500 : numeric
atmospheric aerosol optical depth at 500 nm. [unitless]
aoi : numeric
Angle of incidence on the vertical surface. See :term:`aoi`.
Copy link
Member

Choose a reason for hiding this comment

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

In the paper I read:

"...being the angle of incidence corresponding to 90° of tilt angle and the surface azimuth."

Does that really mean the same as this comment in the code?

Copy link
Member

Choose a reason for hiding this comment

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

It seems the same to me. What difference do you see @adriesse?

Copy link
Member

Choose a reason for hiding this comment

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

It's an awkward wording so I was just looking for confirmation from @jesuspolo

[degrees]
altitude: numeric
altitude over sea level. [m]
module_type : str, optional
One of the following PV technology strings from [1]_:
Copy link
Member

Choose a reason for hiding this comment

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

Are the SR curves used to develop this model open data?

* ``'cdte'`` - anonymous CdTe module.
* ``'monosi'`` - anonymous monocrystalline silicon module.
* ``'cigs'`` - anonymous copper indium gallium selenide module.
* ``'asi'`` - anonymous amorphous silicon module.
albedo : float, optional
Ground albedo (default value 0.2). See :term:`albedo`. [unitless]
coefficients : array-like, optional
user-defined coefficients, if not using one of the coefficient
sets via the ``module_type`` parameter.
Returns
-------
modifier: numeric
spectral mismatch factor (unitless) which is multiplied
with broadband irradiance reaching a module's cells to estimate
effective irradiance, i.e., the irradiance that is converted to
electrical current.

Check failure on line 756 in pvlib/spectrum/mismatch.py

View workflow job for this annotation

GitHub Actions / flake8-linter

F841 local variable 'am_aoi' is assigned to but never used
References
----------

Check failure on line 758 in pvlib/spectrum/mismatch.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E501 line too long (82 > 79 characters)

Check failure on line 758 in pvlib/spectrum/mismatch.py

View workflow job for this annotation

GitHub Actions / flake8-linter

E225 missing whitespace around operator
.. [1] J. Polo and C. Sanz-Saiz, 'Development of spectral mismatch models
for BIPV applications in building façades', Renewable Energy, vol. 245,
p. 122820, Jun. 2025, :doi:`10.1016/j.renene.2025.122820`
"""
if module_type is None and coefficients is None:
raise ValueError('Must provide either `module_type` or `coefficients`')
if module_type is not None and coefficients is not None:
raise ValueError('Only one of `module_type` and `coefficients` should '
'be provided')
am_aoi = pvlib.atmosphere.get_relative_airmass(aoi)
Copy link
Member

Choose a reason for hiding this comment

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

This will produce a nan if aoi > 90.

Copy link
Member

Choose a reason for hiding this comment

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

@jesuspolo: how should $R_{AM}$ be calculated when the angle of incidence $\theta > 90\degree$ ? I guess something special should be done, but I do not see it specified in the paper.

pressure = pvlib.atmosphere.alt2pres(altitude)
f_aoi_rel= pvlib.atmosphere.get_relative_airmass(aoi, model='kastenyoung1989')
f_aoi = pvlib.atmosphere.get_absolute_airmass(f_aoi_rel, pressure)
Ram = f_aoi / airmass_absolute
_coefficients = {
'cdte': (-0.0009, 46.80, 49.20, -0.87, 0.00041, 0.053),
'monosi': (0.0027, 10.34, 9.48, 0.307, 0.00077, 0.006),
'cigs': (0.0017, 2.33, 1.30, 0.11, 0.00098, -0.0177),
'asi': (0.0024, 7.32, 7.09, -0.72, -0.0013, 0.089),
}
c = {
'asi': (0.0056, -0.020, 1.014),
'cigs': (-0.0009, -0.0003, 1),
'cdte': (0.0021, -0.01, 1.01),
'monosi': (0, -0.003, 1.0),
}
if module_type is not None:
coeff = _coefficients[module_type]
c_albedo = c[module_type]
else:
coeff = coefficients
c_albedo = (0.0, 0.0, 1.0) # 0.2 albedo assumed
smm = coeff[0] * Ram + coeff[1] / (coeff[2] + Ram**coeff[3]) \
+ coeff[4] / aod500 + coeff[5]*np.sqrt(precipitable_water)
# Ground albedo correction
g = c_albedo[0] * (albedo/0.2)**2 \
+ c_albedo[1] * (albedo/0.2) + c_albedo[2]
return g*smm
22 changes: 22 additions & 0 deletions tests/spectrum/test_mismatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,25 @@ def test_spectral_factor_jrc_supplied_ambiguous():
with pytest.raises(ValueError, match='No valid input provided'):
spectrum.spectral_factor_jrc(1.0, 0.8, module_type=None,
coefficients=None)


@pytest.mark.parametrize("module_type,expected", [
('cdte', np.array(
[0.991926, 0.999809, 1.01108, 0.993319, 0.956621, 0.970872])),
('monosi', np.array(
[1.00174, 0.971769, 0.986224, 1.01661, 1.02026, 1.0106])),
('cigs', np.array(
[1.00769, 0.959666, 0.974438, 1.02861, 1.05203, 1.03117])),
('asi', np.array(
[0.982133, 1.04674, 1.04859, 0.951109, 0.865328, 0.919515])),
])
def test_spectral_factor_polo(module_type, expected):
altitude = 500
pws = np.array([0.96, 0.96, 1.85, 1.88, 0.66, 0.66])
aods = np.array([0.085, 0.085, 0.16, 0.19, 0.088, 0.088])
ams = np.array([1.34, 1.34, 2.2, 2.2, 2.6, 2.6])
aois = np.array([46.0, 76.0, 74.0, 28.0, 24.0, 55.0])
alb = np.array([0.15, 0.2, 0.3, 0.18, 0.32, 0.26])
out = spectrum.spectral_factor_polo(
pws, ams, aods, aois, altitude, module_type=module_type, albedo=alb)
assert np.allclose(expected, out, atol=1e-8)
Loading