You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
Activity
aarmens702-hub commentedon Nov 3, 2026
I'd like to work on this. Here's the approach I have in mind, to check before opening a PR.
A
decomposition_modelstring keyword onModelChain, liketransposition_model, with defaultNone:In
prepare_inputs, right after the solar position step, if the weather hasghibut neitherdninordhi, it callsmodel(ghi, solar_position['zenith'], times)and addsdnianddhitoresults.weather. WithNone, nothing changes.pvlib-python/pvlib/modelchain.py
Lines 1386 to 1389 in c5de586
I tried it locally. It's about 30 lines in
modelchain.py. With GHI-only weather,run_modelgives the same AC output as runningerbsby hand and passing all three columns. Per-array weather tuples work too.Questions:
erbs,erbs_driesse,boland,loucheandorgill_hollands? They return both DNI and DHI.discanddirintonly return DNI (Inconsistent output content across decomposition models #2865).aoi_model?dnianddhi, I use them as given. If only one is there, I kept the current error. Is that right?get_irradiance_componentsfrom Addget_irradiance_componentsfunction #2850 instead of its own lookup?It touches the same part of
prepare_inputsas #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.
kandersolar commentedon Nov 4, 2026
@aarmens702-hub please do not open a PR. This idea needs to be discussed and agreed upon before going forward.