Skip to content

Added pysam options input for battery - #903

Merged
johnjasa merged 5 commits into
NatLabRockies:developfrom
johnjasa:issue_570
Oct 6, 2026
Merged

johnjasa merged 5 commits into
NatLabRockies:developfrom
johnjasa:issue_570

Conversation

@johnjasa

@johnjasa johnjasa commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Allow additional PySAM battery options

  1. Accept an optional pysam_options dictionary for the PySAM battery performance model
  2. Apply user-supplied PySAM settings after sizing while keeping wrapper-managed controls and sizing fields authoritative
  3. Test configured and default battery runs and reject conflicting or unknown option groups

Section 1: Type of Contribution

  • Feature Enhancement
    • Framework
    • New Model
    • Updated Model
    • Tools/Utilities
    • Other (please describe):
  • Bug Fix
  • Documentation Update
  • CI Changes
  • Other (please describe):

Section 2: Draft PR Checklist

  • Open draft PR
  • Describe the feature that will be added
  • Fill out TODO list steps
  • Describe requested feedback from reviewers on draft PR
  • Complete Section 8: New Model Checklist (if applicable)

TODO:

N/A

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback: N/A

Implementation feedback: N/A

Other feedback: N/A

Section 3: General PR Checklist

  • PR description thoroughly describes the new feature, bug fix, etc.
  • Added tests for new functionality or bug fixes
  • Tests pass (If not, and this is expected, please elaborate in Section 7)
  • Documentation
    • Docstrings are up-to-date
    • Related docs/ files are up-to-date, or added when necessary
    • Documentation has been rebuilt successfully
    • Examples have been updated (if applicable)
  • CHANGELOG.md
    • At least one complete sentence has been provided to describe the changes made in this PR
    • A PR link has been added (PR number pending)

Section 4: Related Issues

Resolves #570

Section 5: Impacted Areas of the Software

Section 5.1: New Files

N/A

Section 5.2: Modified Files

  • h2integrate/storage/battery/pysam_battery.py: Accept and apply grouped PySAM options with checks for wrapper-owned fields.
  • h2integrate/storage/battery/test/test_pysam_battery.py: Cover configured and default operation and invalid options.

Section 6: Additional Supporting Information

The technology schema already permits model-specific performance parameters. PySAM rejects unsupported individual parameter names. Existing battery configurations need no changes.

Section 7: Test Results, if applicable

All passed

Section 8 (Optional): New Model Checklist

N/A

@johnjasa
johnjasa requested a review from elenya-grant October 5, 2026 19:00

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you add a test where you change the battery type using pysam_options? I see that as the most likely use case for the options given our user base, and it would be good to see the actual results change based on the inputed pysam_options.

tech_config["technologies"]["battery"]["model_inputs"]["performance_parameters"][
            "pysam_options"
        ] = {"ParamsCell": {"chem": 3}} #iron flow battery

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, I've added a test that runs the battery with two different chemistries and confirms the results are different!

@kbrunik kbrunik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks great! Thanks @johnjasa.

@johnjasa
johnjasa enabled auto-merge October 6, 2026 21:43
@johnjasa
johnjasa merged commit 82cc5f9 into NatLabRockies:develop Oct 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants