Skip to content

Fix error message in ModelChain pertaining to temp_model inference #1946

@matsuobasho

Description

@matsuobasho

Describe the bug
Error message is incorrect.
The message is:

ValueError: could not infer temperature model from system.temperature_model_parameters. Check that all Arrays in system.arrays have parameters for the same temperature model. Common temperature model parameters: set().

However, in code below we are creating a PVSystem without using Arrays. So the second sentence in the message above is not describing the proper way to fix this issue.

To Reproduce

from pvlib import pvsystem
from pvlib.location import Location
from pvlib.modelchain import ModelChain

location = Location(latitude=32.2, longitude=-110.9)

modules = pvsystem.retrieve_sam('cecmod')
module_parameters = modules['Canadian_Solar_Inc__CS5P_220M']
inverter_parameters = {'pdc0': 5000, 'eta_inv_nom': 0.96}
system = pvsystem.PVSystem(inverter_parameters=inverter_parameters,
                           module_parameters=module_parameters)

# create the model chain
modelchain = ModelChain(
    system, location, name='dummy_name', aoi_model="physical", temperature_model="pvsyst"
)

Expected behavior
Error message correctly explains what needs to be changed in pvsystem insantiation in order for ModelChain to run.

Versions:

  • pvlib.__version__: 0.10.2
  • python: 3.9.6

Additional context
This error message also appears in other contexts. Namely for other model types:
AC
AOI
DC
spectral

So the error messages for those models should be fixed as well. Search for 'could not infer' to see which messages.

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