17
17
from abc import ABC , abstractmethod
18
18
from typing import Optional , Union
19
19
20
- from pvlib ._deprecation import deprecated
21
-
22
20
import pvlib # used to avoid albedo name collision in the Array class
23
21
from pvlib import (atmosphere , iam , inverter , irradiance ,
24
22
singlediode as _singlediode , spectrum , temperature )
@@ -2195,25 +2193,32 @@ def _parse_raw_sam_df(csvdata):
2195
2193
return df
2196
2194
2197
2195
2198
- def sapm (effective_irradiance , temp_cell , module ):
2196
+ def sapm (effective_irradiance , temp_cell , module , * , temperature_ref = 25 ,
2197
+ irradiance_ref = 1000 ):
2199
2198
'''
2200
2199
The Sandia PV Array Performance Model (SAPM) generates 5 points on a
2201
2200
PV module's I-V curve (Voc, Isc, Ix, Ixx, Vmp/Imp) according to
2202
- SAND2004-3535. Assumes a reference cell temperature of 25 C.
2201
+ SAND2004-3535. Assumes a reference cell temperature of 25° C.
2203
2202
2204
2203
Parameters
2205
2204
----------
2206
2205
effective_irradiance : numeric
2207
2206
Irradiance reaching the module's cells, after reflections and
2208
- adjustment for spectrum. [W/m2 ]
2207
+ adjustment for spectrum. [Wm⁻² ]
2209
2208
2210
2209
temp_cell : numeric
2211
- Cell temperature [C].
2210
+ Cell temperature [° C].
2212
2211
2213
2212
module : dict-like
2214
2213
A dict or Series defining the SAPM parameters. See the notes section
2215
2214
for more details.
2216
2215
2216
+ temperature_ref : numeric, optional
2217
+ Reference temperature [°C]
2218
+
2219
+ irradiance_ref : numeric, optional
2220
+ Reference irradiance [Wm⁻²]
2221
+
2217
2222
Returns
2218
2223
-------
2219
2224
A DataFrame with the columns:
@@ -2251,19 +2256,19 @@ def sapm(effective_irradiance, temp_cell, module):
2251
2256
Voco Open circuit voltage at reference condition (amps)
2252
2257
Vmpo Maximum power voltage at reference condition (amps)
2253
2258
Aisc Short circuit current temperature coefficient at
2254
- reference condition (1/C)
2259
+ reference condition (1/° C)
2255
2260
Aimp Maximum power current temperature coefficient at
2256
- reference condition (1/C)
2261
+ reference condition (1/° C)
2257
2262
Bvoco Open circuit voltage temperature coefficient at
2258
- reference condition (V/C)
2263
+ reference condition (V/° C)
2259
2264
Mbvoc Coefficient providing the irradiance dependence for the
2260
2265
BetaVoc temperature coefficient at reference irradiance
2261
- (V/C)
2266
+ (V/° C)
2262
2267
Bvmpo Maximum power voltage temperature coefficient at
2263
2268
reference condition
2264
2269
Mbvmp Coefficient providing the irradiance dependence for the
2265
2270
BetaVmp temperature coefficient at reference irradiance
2266
- (V/C)
2271
+ (V/° C)
2267
2272
N Empirically determined "diode factor" (dimensionless)
2268
2273
Cells_in_Series Number of cells in series in a module's cell string(s)
2269
2274
IXO Ix at reference conditions
@@ -2284,16 +2289,11 @@ def sapm(effective_irradiance, temp_cell, module):
2284
2289
pvlib.temperature.sapm_module
2285
2290
'''
2286
2291
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
-
2292
2292
q = constants .e # Elementary charge in units of coulombs
2293
2293
kb = constants .k # Boltzmann's constant in units of J/K
2294
2294
2295
2295
# avoid problem with integer input
2296
- Ee = np .array (effective_irradiance , dtype = 'float64' ) / irrad_ref
2296
+ Ee = np .array (effective_irradiance , dtype = 'float64' ) / irradiance_ref
2297
2297
2298
2298
# set up masking for 0, positive, and nan inputs
2299
2299
Ee_gt_0 = np .full_like (Ee , False , dtype = 'bool' )
@@ -2316,31 +2316,32 @@ def sapm(effective_irradiance, temp_cell, module):
2316
2316
out = OrderedDict ()
2317
2317
2318
2318
out ['i_sc' ] = (
2319
- module ['Isco' ] * Ee * (1 + module ['Aisc' ]* (temp_cell - temp_ref )))
2319
+ module ['Isco' ] * Ee * (1 + module ['Aisc' ]* (temp_cell -
2320
+ temperature_ref )))
2320
2321
2321
2322
out ['i_mp' ] = (
2322
2323
module ['Impo' ] * (module ['C0' ]* Ee + module ['C1' ]* (Ee ** 2 )) *
2323
- (1 + module ['Aimp' ]* (temp_cell - temp_ref )))
2324
+ (1 + module ['Aimp' ]* (temp_cell - temperature_ref )))
2324
2325
2325
2326
out ['v_oc' ] = np .maximum (0 , (
2326
2327
module ['Voco' ] + cells_in_series * delta * logEe +
2327
- Bvoco * (temp_cell - temp_ref )))
2328
+ Bvoco * (temp_cell - temperature_ref )))
2328
2329
2329
2330
out ['v_mp' ] = np .maximum (0 , (
2330
2331
module ['Vmpo' ] +
2331
2332
module ['C2' ] * cells_in_series * delta * logEe +
2332
2333
module ['C3' ] * cells_in_series * ((delta * logEe ) ** 2 ) +
2333
- Bvmpo * (temp_cell - temp_ref )))
2334
+ Bvmpo * (temp_cell - temperature_ref )))
2334
2335
2335
2336
out ['p_mp' ] = out ['i_mp' ] * out ['v_mp' ]
2336
2337
2337
2338
out ['i_x' ] = (
2338
2339
module ['IXO' ] * (module ['C4' ]* Ee + module ['C5' ]* (Ee ** 2 )) *
2339
- (1 + module ['Aisc' ]* (temp_cell - temp_ref )))
2340
+ (1 + module ['Aisc' ]* (temp_cell - temperature_ref )))
2340
2341
2341
2342
out ['i_xx' ] = (
2342
2343
module ['IXXO' ] * (module ['C6' ]* Ee + module ['C7' ]* (Ee ** 2 )) *
2343
- (1 + module ['Aimp' ]* (temp_cell - temp_ref )))
2344
+ (1 + module ['Aimp' ]* (temp_cell - temperature_ref )))
2344
2345
2345
2346
if isinstance (out ['i_sc' ], pd .Series ):
2346
2347
out = pd .DataFrame (out )
0 commit comments