Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pvsystem._DC_MODEL_PARAMS lists unnecessary parameters for SAPM #2369

Closed
@kandersolar

Description

@kandersolar

pvlib.pvsystem._DC_MODEL_PARAMS lists parameter names for each of several DC models, including the SAPM:

# a dict of required parameter names for each DC power model
_DC_MODEL_PARAMS = {
'sapm': {
'A0', 'A1', 'A2', 'A3', 'A4', 'B0', 'B1', 'B2', 'B3',
'B4', 'B5', 'C0', 'C1', 'C2', 'C3', 'C4', 'C5', 'C6',
'C7', 'Isco', 'Impo', 'Voco', 'Vmpo', 'Aisc', 'Aimp', 'Bvoco',
'Mbvoc', 'Bvmpo', 'Mbvmp', 'N', 'Cells_in_Series',
'IXO', 'IXXO', 'FD'},

Many of these SAPM parameters are not used in the SAPM DC model. A0-A4 are for the airmass modifier. B0-B5 are for beam IAM. FD is for diffuse IAM. None of these are required to run the DC portion of the SAPM, implemented in pvlib.pvsystem.sapm.

However, because these non-DC parameters are listed in _DC_MODEL_PARAMS, ModelChain raises an error if you do not supply them when setting dc_model='sapm'. Here is an example of code that I would like to execute successfully:

import pvlib
sapm_parameters = {
    # required parameters
    'C0': 1.02, 'C1': -0.018, 'C2': -0.15, 'C3': -12.26,
    'Isco': 14.03, 'Impo': 13.38, 'Voco': 51.54, 'Vmpo': 42.89,
    'Aisc': 0.00049, 'Aimp': 0.00050, 'Bvoco': -0.132, 'Bvmpo': -0.150,
    'Mbvoc': 0, 'Mbvmp': 0,
    'N': 1.128, 'Cells_in_Series': 72,
    # required parameters, but only for uninteresting outputs, so supply dummy values:
    'IXO': 0, 'IXXO': 0,
    'C4': 0, 'C5': 0, 'C6': 0, 'C7': 0
}

location = pvlib.location.Location(40, -80)
system = pvlib.pvsystem.PVSystem(module_parameters=sapm_parameters, inverter_parameters={'pdc0': 300})

mc = pvlib.modelchain.ModelChain(system, location, dc_model='sapm', spectral_model='no_loss', aoi_model='no_loss')

However, with the current pvlib, it fails, complaining about the missing non-DC parameters:

ValueError: sapm selected for the DC model but one or more Arrays are missing one or more required parameters  : {'B4', 'FD', 'B5', 'B1', 'A3', 'B0', 'B2', 'A0', 'A4', 'A2', 'B3', 'A1'}

I propose we remove the A*, B*, and FD parameters from this dictionary.

I could not locate any previous discussion of this, aside from a very brief exchange when the dictionary was first added: #548 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions