Skip to content

Add decomposition model to Modelchain suite #2917

Open

Description

@ramaroesilva

Is your feature request related to a problem? Please describe.
Modelchain does not include the decomposition step, forcing it to be done outside/before the modelchain.

Describe the solution you'd like
Modelchain could allow decomposition as an optional parameter. By default it could be None, keeping the current demand for users to include dhi and dni in the weather data. But if not None only ghi would be asked.

Additional context
I understand that having it as optional allows users to implement their own custom decomposition if they want. Similar to the run_model_from_poa option for users to ingest their own modelled or measured poa data.

Activity

  1. aarmens702-hub commented on Nov 3, 2026

    @aarmens702-hub

    I'd like to work on this. Here's the approach I have in mind, to check before opening a PR.

    A decomposition_model string keyword on ModelChain, like transposition_model, with default None:

    mc = ModelChain(system, location, decomposition_model='erbs')
    mc.run_model(weather)  # weather only needs 'ghi'

    In prepare_inputs, right after the solar position step, if the weather has ghi but neither dni nor dhi, it calls model(ghi, solar_position['zenith'], times) and adds dni and dhi to results.weather. With None, nothing changes.

    self._verify_df(weather, required=['ghi', 'dni', 'dhi'])
    self._assign_weather(weather)
    self._prep_inputs_solar_pos(weather)

    I tried it locally. It's about 30 lines in modelchain.py. With GHI-only weather, run_model gives the same AC output as running erbs by hand and passing all three columns. Per-array weather tuples work too.

    Questions:

    1. Start with erbs, erbs_driesse, boland, louche and orgill_hollands? They return both DNI and DHI. disc and dirint only return DNI (Inconsistent output content across decomposition models #2865).
    2. Strings only, with no model kwargs for now? Or should it also accept a function, like aoi_model?
    3. If the weather already has dni and dhi, I use them as given. If only one is there, I kept the current error. Is that right?
    4. Should this use get_irradiance_components from Add get_irradiance_components function #2850 instead of its own lookup?

    It touches the same part of prepare_inputs as #2847, so I can wait for that and rebase.

    AI disclosure: I used Claude Code (an AI coding agent) to read the code and prototype this approach.

  2. kandersolar commented on Nov 4, 2026

    @kandersolar
    Member

    @aarmens702-hub please do not open a PR. This idea needs to be discussed and agreed upon before going forward.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions