Skip to content

Commit a564b32

Browse files
committed
add ref irr/t as optional args, rename
1 parent a4e5017 commit a564b32

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

pvlib/pvsystem.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,7 +2195,8 @@ def _parse_raw_sam_df(csvdata):
21952195
return df
21962196

21972197

2198-
def sapm(effective_irradiance, temp_cell, module):
2198+
def sapm(effective_irradiance, temp_cell, module, reference_temperature = 25,
2199+
reference_irradiance = 1000):
21992200
'''
22002201
The Sandia PV Array Performance Model (SAPM) generates 5 points on a
22012202
PV module's I-V curve (Voc, Isc, Ix, Ixx, Vmp/Imp) according to
@@ -2284,16 +2285,11 @@ def sapm(effective_irradiance, temp_cell, module):
22842285
pvlib.temperature.sapm_module
22852286
'''
22862287

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-
22922288
q = constants.e # Elementary charge in units of coulombs
22932289
kb = constants.k # Boltzmann's constant in units of J/K
22942290

22952291
# avoid problem with integer input
2296-
Ee = np.array(effective_irradiance, dtype='float64') / irrad_ref
2292+
Ee = np.array(effective_irradiance, dtype='float64') / reference_irradiance
22972293

22982294
# set up masking for 0, positive, and nan inputs
22992295
Ee_gt_0 = np.full_like(Ee, False, dtype='bool')
@@ -2316,31 +2312,31 @@ def sapm(effective_irradiance, temp_cell, module):
23162312
out = OrderedDict()
23172313

23182314
out['i_sc'] = (
2319-
module['Isco'] * Ee * (1 + module['Aisc']*(temp_cell - temp_ref)))
2315+
module['Isco'] * Ee * (1 + module['Aisc']*(temp_cell - reference_temperature)))
23202316

23212317
out['i_mp'] = (
23222318
module['Impo'] * (module['C0']*Ee + module['C1']*(Ee**2)) *
2323-
(1 + module['Aimp']*(temp_cell - temp_ref)))
2319+
(1 + module['Aimp']*(temp_cell - reference_temperature)))
23242320

23252321
out['v_oc'] = np.maximum(0, (
23262322
module['Voco'] + cells_in_series * delta * logEe +
2327-
Bvoco*(temp_cell - temp_ref)))
2323+
Bvoco*(temp_cell - reference_temperature)))
23282324

23292325
out['v_mp'] = np.maximum(0, (
23302326
module['Vmpo'] +
23312327
module['C2'] * cells_in_series * delta * logEe +
23322328
module['C3'] * cells_in_series * ((delta * logEe) ** 2) +
2333-
Bvmpo*(temp_cell - temp_ref)))
2329+
Bvmpo*(temp_cell - reference_temperature)))
23342330

23352331
out['p_mp'] = out['i_mp'] * out['v_mp']
23362332

23372333
out['i_x'] = (
23382334
module['IXO'] * (module['C4']*Ee + module['C5']*(Ee**2)) *
2339-
(1 + module['Aisc']*(temp_cell - temp_ref)))
2335+
(1 + module['Aisc']*(temp_cell - reference_temperature)))
23402336

23412337
out['i_xx'] = (
23422338
module['IXXO'] * (module['C6']*Ee + module['C7']*(Ee**2)) *
2343-
(1 + module['Aimp']*(temp_cell - temp_ref)))
2339+
(1 + module['Aimp']*(temp_cell - reference_temperature)))
23442340

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

0 commit comments

Comments
 (0)