diff --git a/docs/sphinx/source/whatsnew/v0.2.1.txt b/docs/sphinx/source/whatsnew/v0.2.1.txt index 36fa8d5e7d..32c06f78f8 100644 --- a/docs/sphinx/source/whatsnew/v0.2.1.txt +++ b/docs/sphinx/source/whatsnew/v0.2.1.txt @@ -7,6 +7,12 @@ This is a minor release from 0.2. It includes a large number of bug fixes for the IPython notebook tutorials. We recommend that all users upgrade to this version. +Enhancements +~~~~~~~~~~~~ + +* Update component info from SAM (csvs dated 2015-6-30) (:issue:`75`) + + Bug fixes ~~~~~~~~~ @@ -16,4 +22,5 @@ Bug fixes Contributors ~~~~~~~~~~~~ -* Will Holmgren \ No newline at end of file +* Will Holmgren +* Jessica Forbess diff --git a/pvlib/pvsystem.py b/pvlib/pvsystem.py index 83529dc012..c055b2d8b2 100644 --- a/pvlib/pvsystem.py +++ b/pvlib/pvsystem.py @@ -294,12 +294,12 @@ def calcparams_desoto(poa_global, temp_cell, alpha_isc, module_parameters, database. The module_parameters dict must contain the following 5 fields: - * A_ref - modified diode ideality factor parameter at + * a_ref - modified diode ideality factor parameter at reference conditions (units of eV), a_ref can be calculated from the usual diode ideality factor (n), number of cells in series (Ns), and cell temperature (Tcell) per equation (2) in [1]. - * I_l_ref - Light-generated current (or photocurrent) + * I_L_ref - Light-generated current (or photocurrent) in amperes at reference conditions. This value is referred to as Iph in some literature. * I_o_ref - diode reverse saturation current in amperes, @@ -447,8 +447,8 @@ def calcparams_desoto(poa_global, temp_cell, alpha_isc, module_parameters, ''' M = np.max(M, 0) - a_ref = module_parameters['A_ref'] - IL_ref = module_parameters['I_l_ref'] + a_ref = module_parameters['a_ref'] + IL_ref = module_parameters['I_L_ref'] I0_ref = module_parameters['I_o_ref'] Rsh_ref = module_parameters['R_sh_ref'] Rs_ref = module_parameters['R_s'] @@ -472,13 +472,13 @@ def calcparams_desoto(poa_global, temp_cell, alpha_isc, module_parameters, def retrieve_sam(name=None, samfile=None): ''' - Retrieve lastest module and inverter info from SAM website. + Retrieve latest module and inverter info from SAM website. This function will retrieve either: * CEC module database * Sandia Module database - * Sandia Inverter database + * CEC Inverter database and return it as a pandas dataframe. @@ -489,7 +489,8 @@ def retrieve_sam(name=None, samfile=None): Name can be one of: * 'CECMod' - returns the CEC module database - * 'SandiaInverter' - returns the Sandia Inverter database + * 'CECInverter' - returns the CEC Inverter database + * 'SandiaInverter' - returns the CEC Inverter database (CEC is only current inverter db available; tag kept for backwards compatibility) * 'SandiaMod' - returns the Sandia Module database samfile : String @@ -503,14 +504,14 @@ def retrieve_sam(name=None, samfile=None): Returns ------- A DataFrame containing all the elements of the desired database. - Each column representa a module or inverter, and a specific dataset - can be retreived by the command + Each column represents a module or inverter, and a specific dataset + can be retrieved by the command Examples -------- >>> from pvlib import pvsystem - >>> invdb = pvsystem.retrieve_sam(name='SandiaInverter') + >>> invdb = pvsystem.retrieve_sam(name='CECInverter') >>> inverter = invdb.AE_Solar_Energy__AE6_0__277V__277V__CEC_2012_ >>> inverter Vac 277.000000 @@ -534,11 +535,11 @@ def retrieve_sam(name=None, samfile=None): name = name.lower() if name == 'cecmod': - url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-cec-modules-2014-1-14.csv' + url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-cec-modules-2015-6-30.csv' elif name == 'sandiamod': - url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-sandia-modules-2014-1-14.csv' - elif name == 'sandiainverter': - url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-sandia-inverters-2014-1-14.csv' + url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-sandia-modules-2015-6-30.csv' + elif name in ['cecinverter', 'sandiainverter']: # Allowing either, to provide for old code, while aligning with current expectations + url = 'https://sam.nrel.gov/sites/sam.nrel.gov/files/sam-library-cec-inverters-2015-6-30.csv' elif samfile is None: raise ValueError('invalid name {}'.format(name)) @@ -561,13 +562,22 @@ def retrieve_sam(name=None, samfile=None): def _parse_raw_sam_df(csvdata): - df = pd.read_csv(csvdata, index_col=0) + df = pd.read_csv(csvdata, index_col=0, skiprows=[1,2]) + colnames = df.columns.values.tolist() + parsedcolnames = [] + for cn in colnames: + parsedcolnames.append(cn.replace(' ', '_')) + + df.columns = parsedcolnames + parsedindex = [] for index in df.index: parsedindex.append(index.replace(' ', '_').replace('-', '_') .replace('.', '_').replace('(', '_') .replace(')', '_').replace('[', '_') - .replace(']', '_').replace(':', '_')) + .replace(']', '_').replace(':', '_') + .replace('+', '_').replace('/', '_') + .replace('"', '_').replace(',', '_')) df.index = parsedindex df = df.transpose() @@ -635,7 +645,7 @@ def sapm(module, poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi): reference condition (1/C) Aimp Maximum power current temperature coefficient at reference condition (1/C) - Bvoc Open circuit voltage temperature coefficient at + Bvoco Open circuit voltage temperature coefficient at reference condition (V/C) Mbvoc Coefficient providing the irradiance dependence for the BetaVoc temperature coefficient at reference irradiance (V/C) @@ -644,7 +654,7 @@ def sapm(module, poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi): Mbvmp Coefficient providing the irradiance dependence for the BetaVmp temperature coefficient at reference irradiance (V/C) N Empirically determined "diode factor" (dimensionless) - #Series Number of cells in series in a module's cell string(s) + Cells_in_Series Number of cells in series in a module's cell string(s) IXO Ix at reference conditions IXXO Ixx at reference conditions FD Fraction of diffuse irradiance used by module @@ -693,12 +703,12 @@ def sapm(module, poa_direct, poa_diffuse, temp_cell, airmass_absolute, aoi): (1 + module['Aimp']*(temp_cell - T0)) ) dfout['v_oc'] = (( module['Voco'] + - module['#Series']*delta*np.log(Ee) + Bvoco*(temp_cell - T0) ) + module['Cells_in_Series']*delta*np.log(Ee) + Bvoco*(temp_cell - T0) ) .clip_lower(0)) dfout['v_mp'] = ( module['Vmpo'] + - module['C2']*module['#Series']*delta*np.log(Ee) + - module['C3']*module['#Series']*((delta*np.log(Ee)) ** 2) + + module['C2']*module['Cells_in_Series']*delta*np.log(Ee) + + module['C3']*module['Cells_in_Series']*((delta*np.log(Ee)) ** 2) + Bvmpo*(temp_cell - T0) ).clip_lower(0) dfout['p_mp'] = dfout['i_mp'] * dfout['v_mp'] diff --git a/pvlib/test/test_pvsystem.py b/pvlib/test/test_pvsystem.py index 518ca381e4..babe1c0df1 100644 --- a/pvlib/test/test_pvsystem.py +++ b/pvlib/test/test_pvsystem.py @@ -99,7 +99,7 @@ def test_physicaliam(): def test_retrieve_sam_network(): sam_data['cecmod'] = pvsystem.retrieve_sam('cecmod') sam_data['sandiamod'] = pvsystem.retrieve_sam('sandiamod') - sam_data['sandiainverter'] = pvsystem.retrieve_sam('sandiainverter') + sam_data['cecinverter'] = pvsystem.retrieve_sam('cecinverter') def test_sapm(): @@ -117,7 +117,7 @@ def test_calcparams_desoto(): cecmodule = sam_data['cecmod'].Example_Module pvsystem.calcparams_desoto(irrad_data['ghi'], temp_cell=25, - alpha_isc=cecmodule['Alpha_sc'], + alpha_isc=cecmodule['alpha_sc'], module_parameters=cecmodule, EgRef=1.121, dEgdT=-0.0002677) @@ -133,7 +133,7 @@ def test_singlediode_series(): IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto( irrad_data['ghi'], temp_cell=25, - alpha_isc=cecmodule['Alpha_sc'], + alpha_isc=cecmodule['alpha_sc'], module_parameters=cecmodule, EgRef=1.121, dEgdT=-0.0002677) @@ -180,7 +180,7 @@ def test_sapm_celltemp_with_index(): def test_snlinverter(): - inverters = sam_data['sandiainverter'] + inverters = sam_data['cecinverter'] testinv = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_' vdcs = pd.Series(np.linspace(0,50,3)) idcs = pd.Series(np.linspace(0,11,3)) @@ -191,12 +191,12 @@ def test_snlinverter(): def test_snlinverter_float(): - inverters = sam_data['sandiainverter'] + inverters = sam_data['cecinverter'] testinv = 'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_' vdcs = 25. idcs = 5.5 pdcs = idcs * vdcs pacs = pvsystem.snlinverter(inverters[testinv], vdcs, pdcs) - assert_almost_equals(pacs, 132.004308, 5) + assert_almost_equals(pacs, 132.004278, 5)