Skip to content

Inferring spectral model returns 'first_solar' when not expected #2017

Open
@cwhanse

Description

@cwhanse

A user reports running a model chain with no spectral model specified and with CEC module parameters. The logic for ModelChain.infer_spectral_model returns first_solar_spectral_loss, which expects 'precipitable_water' to be in the weather input, at which point the user's simulation fails.

To Reproduce
Code posted by user to reproduce the error.

import pandas as pd
import pvlib


from pvlib import clearsky, atmosphere, solarposition
from pvlib.modelchain import ModelChain
from pvlib.location import Location
from pvlib.pvsystem import PVSystem, Array, SingleAxisTrackerMount, AbstractMount, FixedMount
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS


location = Location(latitude = 40.30117520975112, longitude = -3.6973221576701967, tz = "Europe/Madrid", altitude = 660, name = 'Ormazabal Getafe')
modules = pvlib.pvsystem.retrieve_sam('CECMod')
inverters = pvlib.pvsystem.retrieve_sam('CECInverter')
module = modules['JA_Solar_JAP72S01_330_SC']
inverter = inverters['SMA_America__STP_33_US_41__480V_']
temp_par = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
system = PVSystem(surface_tilt = 19, surface_azimuth = 170, module_parameters = module, inverter_parameters = inverter,
                  temperature_model_parameters = temp_par, modules_per_string = 17, strings_per_inverter = 6)
modelchain = ModelChain(system, location, aoi_model = 'physical')

times = pd.date_range(start = '2023-06-01', end = '2023-12-15', freq = 'h', tz = location.tz)
solar_position = location.get_solarposition(times)
clearsky = location.get_clearsky(times)

modelchain.run_model(clearsky)

Expected behavior
While the CEC database has enough information (cell technology) to select parameters for the First Solar spectral model, doing so creates an expectation that the user has the inputs for that model. We can't check weather data at the time that ModelChain.spectral_model is set. I am inclined to think that the elif here should go away.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions:

  • pvlib.__version__: 0.10.5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions