Skip to content

CEC modules not accessible through database and local csv-file #1632

Closed
@kimcholi

Description

@kimcholi

I am currently working with PVlib to do a solar energy estimation of an actual setup. This will be done by comparing the modelled power outputs with the measured power outputs of the system. The module implemented in this PV system are stored in the CEC database and are: Trina Solar TSM-400DE09.08, Trina Solar TSM-395DE09.08. Unfortunately they are not available to access via pvlib.pvsystem.retrieve_sam('CECMod‘) but are listed in the csv-file which I downloaded from https://github.com/NREL/SAM/blob/develop/deploy/libraries/CEC%20Modules.csv

First of all, I am wondering if someone knows why they are available on the local csv-file of CEC module library for Fall 2022 release but not accessible when pvlib.pvsystem.retrieve_sam('CECMod‘) is used. Secondly, I have tried to access the information of the PV modules via cec_modules_local.iloc[14224]. But this also gives me an error as soon as I try to plot the power output of the model, see below. I tried to convert the data frame in order to get the correct type of parameters and data but it did not work. I solved the problem in the end by creating a dataframe with all the parameters from the csv-file via copy & paste basically, which is not the nicest solution.

TypeError                                 Traceback (most recent call last)
Cell In [3], line 1
----> 1 mc_core1_1.run_model(df_tmy) #p_mp is in W, hourly values
      2 mc_core1_2.run_model(df_tmy) 
      3 mc_core2.run_model(df_tmy) 

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/modelchain.py:1809, in ModelChain.run_model(self, weather)
   1806 self.spectral_model()
   1807 self.effective_irradiance_model()
-> 1809 self._run_from_effective_irrad(weather)
   1811 return self

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/modelchain.py:1897, in ModelChain._run_from_effective_irrad(self, data)
   1876 """
   1877 Executes the temperature, DC, losses and AC models.
   1878 
   (...)
   1894 ``diode_params`` (if dc_model is a single diode model).
   1895 """
   1896 self._prepare_temperature(data)
-> 1897 self.dc_model()
   1898 self.dc_ohmic_model()
   1899 self.losses_model()

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/modelchain.py:794, in ModelChain.cec(self)
    793 def cec(self):
--> 794     return self._singlediode(self.system.calcparams_cec)

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/modelchain.py:771, in ModelChain._singlediode(self, calcparams_model_function)
    763 def _make_diode_params(photocurrent, saturation_current,
    764                        resistance_series, resistance_shunt,
    765                        nNsVth):
    766     return pd.DataFrame(
    767         {'I_L': photocurrent, 'I_o': saturation_current,
    768          'R_s': resistance_series, 'R_sh': resistance_shunt,
    769          'nNsVth': nNsVth}
    770     )
--> 771 params = calcparams_model_function(self.results.effective_irradiance,
    772                                    self.results.cell_temperature,
    773                                    unwrap=False)
    774 self.results.diode_params = tuple(itertools.starmap(
    775     _make_diode_params, params))
    776 self.results.dc = tuple(itertools.starmap(
    777     self.system.singlediode, params))

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/pvsystem.py:63, in _unwrap_single_value.<locals>.f(*args, **kwargs)
     60 @functools.wraps(func)
     61 def f(*args, **kwargs):
     62     unwrap = kwargs.pop('unwrap', True)
---> 63     x = func(*args, **kwargs)
     64     if unwrap and len(x) == 1:
     65         return x[0]

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/pvsystem.py:561, in PVSystem.calcparams_cec(self, effective_irradiance, temp_cell)
    552 temp_cell = self._validate_per_array(temp_cell)
    554 build_kwargs = functools.partial(
    555     _build_kwargs,
    556     ['a_ref', 'I_L_ref', 'I_o_ref', 'R_sh_ref',
    557      'R_s', 'alpha_sc', 'Adjust', 'EgRef', 'dEgdT',
    558      'irrad_ref', 'temp_ref']
    559 )
--> 561 return tuple(
    562     calcparams_cec(
    563         effective_irradiance, temp_cell,
    564         **build_kwargs(array.module_parameters)
    565     )
    566     for array, effective_irradiance, temp_cell
    567     in zip(self.arrays, effective_irradiance, temp_cell)
    568 )

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/pvsystem.py:562, in <genexpr>(.0)
    552 temp_cell = self._validate_per_array(temp_cell)
    554 build_kwargs = functools.partial(
    555     _build_kwargs,
    556     ['a_ref', 'I_L_ref', 'I_o_ref', 'R_sh_ref',
    557      'R_s', 'alpha_sc', 'Adjust', 'EgRef', 'dEgdT',
    558      'irrad_ref', 'temp_ref']
    559 )
    561 return tuple(
--> 562     calcparams_cec(
    563         effective_irradiance, temp_cell,
    564         **build_kwargs(array.module_parameters)
    565     )
    566     for array, effective_irradiance, temp_cell
    567     in zip(self.arrays, effective_irradiance, temp_cell)
    568 )

File /opt/anaconda3/envs/pvlib/lib/python3.10/site-packages/pvlib/pvsystem.py:2149, in calcparams_cec(effective_irradiance, temp_cell, alpha_sc, a_ref, I_L_ref, I_o_ref, R_sh_ref, R_s, Adjust, EgRef, dEgdT, irrad_ref, temp_ref)
   2044 '''
   2045 Calculates five parameter values for the single diode equation at
   2046 effective irradiance and cell temperature using the CEC
   (...)
   2144 
   2145 '''
   2147 # pass adjusted temperature coefficient to desoto
   2148 return calcparams_desoto(effective_irradiance, temp_cell,
-> 2149                          alpha_sc*(1.0 - Adjust/100),
   2150                          a_ref, I_L_ref, I_o_ref,
   2151                          R_sh_ref, R_s,
   2152                          EgRef=EgRef, dEgdT=dEgdT,
   2153                          irrad_ref=irrad_ref, temp_ref=temp_ref)

TypeError: unsupported operand type(s) for /: 'str' and 'int'

Is someone familiar with this problem and can maybe help me out? Thank you very much, I would appreciate it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions