Skip to content

Fix the Series name of ModelChain DC ohmic losses - #2912

Merged
cwhanse merged 3 commits into
pvlib:mainfrom
xiajiahang:fix/modelchain-ohmic-loss-name
Oct 20, 2026
Merged

cwhanse merged 3 commits into
pvlib:mainfrom
xiajiahang:fix/modelchain-ohmic-loss-name

Conversation

@xiajiahang

@xiajiahang xiajiahang commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ModelChain.results.dc_ohmic_losses inherits the name i_mp from its
input current Series, although the result contains power losses. Name the
Series p_dc_ohmic_loss for both single-array and tuple results, document
the name, and extend the existing ModelChain regression tests.

Validation:

  • Regression tests before the fix: 3 failures on the incorrect Series name.

  • python -m pytest tests/test_modelchain.py -q: 160 passed.

  • python -m pytest -q: 1449 passed, 177 skipped, 2 xfailed; 22 warnings.

  • python -m flake8 pvlib/modelchain.py tests/test_modelchain.py: passed.

  • git diff --check: passed.

  • Closes Name field of modelchain.results.dc_ohmic_losses is i_mp, which is not correct #1959

  • I am familiar with the contributing guidelines

  • I attest that all AI-generated material has been vetted for accuracy and is in compliance with the pvlib license

  • Tests added

  • Updates entries in docs/sphinx/source/reference for API changes. (Not applicable: no new API; existing result attribute documentation updated.)

  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).

  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.

  • Pull request is nearly complete and ready for detailed review.

  • Maintainer: Appropriate GitHub Labels (including remote-data) and Milestone are assigned to the Pull Request and linked Issue.

@github-actions

Copy link
Copy Markdown

Hey @xiajiahang! 🎉

Thanks for opening your first pull request! We appreciate your
contribution. Please ensure you have reviewed and understood the
contributing guidelines.

If AI is used for any portion of this PR, you must vet the content
for technical accuracy.

Finally, be sure the PR description includes the PR
checklist,
and complete the items you are able to.

@echedey-ls echedey-ls left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Comment thread docs/sphinx/source/whatsnew/v0.16.2.rst Outdated
~~~~~~~~~
* Correct the Series name in ``ModelChain.results.dc_ohmic_losses`` from
``i_mp`` to ``p_dc_ohmic_loss`` when using ``dc_ohms_from_percent``.
(:issue:`1959`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(:issue:`1959`)
(:issue:`1959`, :pull:`2912`)

Comment thread pvlib/modelchain.py Outdated
@cwhanse cwhanse added the bug label Oct 20, 2026
@cwhanse cwhanse added this to the v0.16.2 milestone Oct 20, 2026
@cwhanse

cwhanse commented Oct 20, 2026

Copy link
Copy Markdown
Member

thanks @xiajiahang

@cwhanse
cwhanse merged commit 4d24806 into pvlib:main Oct 20, 2026
28 checks passed
@echedey-ls echedey-ls added bug and removed bug labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Name field of modelchain.results.dc_ohmic_losses is i_mp, which is not correct

3 participants