Skip to content

Commit 9c7f962

Browse files
authored
Merge branch 'main' into sapm-ixx
2 parents e0ac4c5 + 56811e6 commit 9c7f962

File tree

5 files changed

+81
-25
lines changed

5 files changed

+81
-25
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ Enhancements
2121
:py:func:`pvlib.pvsystem.sapm` directly and through
2222
:py:class:`~pvlib.pvsystem.PVSystem` and :py:class:`~pvlib.modelchain.ModelChain`.
2323
(:issue:`2402`, :pull:`2433`)
24+
* Add optional arguments ``temperature_ref`` and ``irradiance_ref`` to
25+
:py:func:`~pvlib.pvsystem.sapm`(:issue:`2432`, :pull:`2434`)
2426

2527
Documentation
2628
~~~~~~~~~~~~~
2729
* Add a supporting reference to :py:func:`pvlib.atmosphere.get_relative_airmass` (:issue:`2390`, :pull:`2424`)
2830
* Documented how `np.nan` values are handled by :py:func:`~pvlib.spectrum.average_photon_energy`
2931
(:issue:`2423`, :pull:`2426`)
3032

33+
Requirements
34+
~~~~~~~~~~~~
35+
* ``wheel`` is no longer a build dependency. (:pull:`2439`)
36+
3137
Testing
3238
~~~~~~~
3339

3440

3541
Maintenance
3642
~~~~~~~~~~~
43+
* Update ``pyproject.toml`` to replace deprecated license table and
44+
classifiers. (:issue:`2440`, :pull:`2441`)
3745

3846

3947
Contributors
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.. _whatsnew_0_X_Y:
2+
3+
4+
v0.X.Y (Month XX, 20YY)
5+
-----------------------
6+
7+
Breaking Changes
8+
~~~~~~~~~~~~~~~~
9+
10+
11+
Deprecations
12+
~~~~~~~~~~~~
13+
14+
15+
Bug fixes
16+
~~~~~~~~~
17+
18+
19+
Enhancements
20+
~~~~~~~~~~~~
21+
22+
23+
Documentation
24+
~~~~~~~~~~~~~
25+
26+
27+
Testing
28+
~~~~~~~
29+
30+
31+
Benchmarking
32+
~~~~~~~~~~~~
33+
34+
35+
Requirements
36+
~~~~~~~~~~~~
37+
38+
39+
Maintenance
40+
~~~~~~~~~~~
41+
42+
43+
Contributors
44+
~~~~~~~~~~~~
45+

pvlib/pvsystem.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,25 +2193,32 @@ def _parse_raw_sam_df(csvdata):
21932193
return df
21942194

21952195

2196-
def sapm(effective_irradiance, temp_cell, module):
2196+
def sapm(effective_irradiance, temp_cell, module, *, temperature_ref=25,
2197+
irradiance_ref=1000):
21972198
'''
21982199
The Sandia PV Array Performance Model (SAPM) generates 5 points on a
21992200
PV module's I-V curve (Voc, Isc, Ix, Ixx, Vmp/Imp) according to
2200-
SAND2004-3535. Assumes a reference cell temperature of 25 C.
2201+
SAND2004-3535. Assumes a reference cell temperature of 25°C.
22012202
22022203
Parameters
22032204
----------
22042205
effective_irradiance : numeric
22052206
Irradiance reaching the module's cells, after reflections and
2206-
adjustment for spectrum. [W/m2]
2207+
adjustment for spectrum. [Wm⁻²]
22072208
22082209
temp_cell : numeric
2209-
Cell temperature [C].
2210+
Cell temperature [°C].
22102211
22112212
module : dict-like
22122213
A dict or Series defining the SAPM parameters. See the notes section
22132214
for more details.
22142215
2216+
temperature_ref : numeric, optional
2217+
Reference temperature [°C]
2218+
2219+
irradiance_ref : numeric, optional
2220+
Reference irradiance [Wm⁻²]
2221+
22152222
Returns
22162223
-------
22172224
A DataFrame with the columns:
@@ -2251,19 +2258,19 @@ def sapm(effective_irradiance, temp_cell, module):
22512258
Voco Open circuit voltage at reference condition (amps)
22522259
Vmpo Maximum power voltage at reference condition (amps)
22532260
Aisc Short circuit current temperature coefficient at
2254-
reference condition (1/C)
2261+
reference condition (1/°C)
22552262
Aimp Maximum power current temperature coefficient at
2256-
reference condition (1/C)
2263+
reference condition (1/°C)
22572264
Bvoco Open circuit voltage temperature coefficient at
2258-
reference condition (V/C)
2265+
reference condition (V/°C)
22592266
Mbvoc Coefficient providing the irradiance dependence for the
22602267
BetaVoc temperature coefficient at reference irradiance
2261-
(V/C)
2268+
(V/°C)
22622269
Bvmpo Maximum power voltage temperature coefficient at
22632270
reference condition
22642271
Mbvmp Coefficient providing the irradiance dependence for the
22652272
BetaVmp temperature coefficient at reference irradiance
2266-
(V/C)
2273+
(V/°C)
22672274
N Empirically determined "diode factor" (dimensionless)
22682275
Cells_in_Series Number of cells in series in a module's cell string(s)
22692276
IXO Ix at reference conditions
@@ -2284,16 +2291,11 @@ def sapm(effective_irradiance, temp_cell, module):
22842291
pvlib.temperature.sapm_module
22852292
'''
22862293

2287-
# TODO: someday, change temp_ref and irrad_ref to reference_temperature and
2288-
# reference_irradiance and expose
2289-
temp_ref = 25
2290-
irrad_ref = 1000
2291-
22922294
q = constants.e # Elementary charge in units of coulombs
22932295
kb = constants.k # Boltzmann's constant in units of J/K
22942296

22952297
# avoid problem with integer input
2296-
Ee = np.array(effective_irradiance, dtype='float64') / irrad_ref
2298+
Ee = np.array(effective_irradiance, dtype='float64') / irradiance_ref
22972299

22982300
# set up masking for 0, positive, and nan inputs
22992301
Ee_gt_0 = np.full_like(Ee, False, dtype='bool')
@@ -2316,33 +2318,34 @@ def sapm(effective_irradiance, temp_cell, module):
23162318
out = OrderedDict()
23172319

23182320
out['i_sc'] = (
2319-
module['Isco'] * Ee * (1 + module['Aisc']*(temp_cell - temp_ref)))
2321+
module['Isco'] * Ee * (1 + module['Aisc']*(temp_cell -
2322+
temperature_ref)))
23202323

23212324
out['i_mp'] = (
23222325
module['Impo'] * (module['C0']*Ee + module['C1']*(Ee**2)) *
2323-
(1 + module['Aimp']*(temp_cell - temp_ref)))
2326+
(1 + module['Aimp']*(temp_cell - temperature_ref)))
23242327

23252328
out['v_oc'] = np.maximum(0, (
23262329
module['Voco'] + cells_in_series * delta * logEe +
2327-
Bvoco*(temp_cell - temp_ref)))
2330+
Bvoco*(temp_cell - temperature_ref)))
23282331

23292332
out['v_mp'] = np.maximum(0, (
23302333
module['Vmpo'] +
23312334
module['C2'] * cells_in_series * delta * logEe +
23322335
module['C3'] * cells_in_series * ((delta * logEe) ** 2) +
2333-
Bvmpo*(temp_cell - temp_ref)))
2336+
Bvmpo*(temp_cell - temperature_ref)))
23342337

23352338
out['p_mp'] = out['i_mp'] * out['v_mp']
23362339

23372340
if 'IXO' in module and 'C4' in module and 'C5' in module:
23382341
out['i_x'] = (
23392342
module['IXO'] * (module['C4']*Ee + module['C5']*(Ee**2)) *
2340-
(1 + module['Aisc']*(temp_cell - temp_ref)))
2343+
(1 + module['Aisc']*(temp_cell - temperature_ref)))
23412344

23422345
if 'IXXO' in module and 'C6' in module and 'C7' in module:
23432346
out['i_xx'] = (
23442347
module['IXXO'] * (module['C6']*Ee + module['C7']*(Ee**2)) *
2345-
(1 + module['Aimp']*(temp_cell - temp_ref)))
2348+
(1 + module['Aimp']*(temp_cell - temperature_ref)))
23462349

23472350
if isinstance(out['i_sc'], pd.Series):
23482351
out = pd.DataFrame(out)

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61", "wheel", "setuptools_scm>=6.2"]
2+
requires = ["setuptools>=70.1", "setuptools_scm>=6.2"]
33
build-backend = "setuptools.build_meta"
44

55

@@ -18,10 +18,9 @@ dependencies = [
1818
'scipy >= 1.6.0',
1919
'h5py',
2020
]
21-
license = { text = "BSD-3-Clause" }
21+
license = "BSD-3-Clause"
2222
classifiers = [
2323
'Development Status :: 4 - Beta',
24-
'License :: OSI Approved :: BSD License',
2524
'Operating System :: OS Independent',
2625
'Intended Audience :: Science/Research',
2726
'Programming Language :: Python',

tests/iotools/test_solaranywhere.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ def test_get_solaranywhere_timeout_tgy(solaranywhere_api_key):
283283
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY)
284284
def test_get_solaranywhere_not_available(solaranywhere_api_key):
285285
# Test if RuntimeError is raised if location in the ocean is requested
286-
with pytest.raises(RuntimeError, match="Tile is outside of our coverage"):
286+
with pytest.raises(RuntimeError,
287+
match="Location is outside of our coverage area"):
287288
pvlib.iotools.get_solaranywhere(
288289
latitude=40, longitude=-70,
289290
api_key=solaranywhere_api_key,

0 commit comments

Comments
 (0)