@@ -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 )
0 commit comments