Skip to content

Update to PySAM Battery so size is changed in compute()#557

Open
elenya-grant wants to merge 2 commits intoNatLabRockies:developfrom
elenya-grant:dispatch/pysam_battery_updates
Open

Update to PySAM Battery so size is changed in compute()#557
elenya-grant wants to merge 2 commits intoNatLabRockies:developfrom
elenya-grant:dispatch/pysam_battery_updates

Conversation

@elenya-grant
Copy link
Collaborator

Update to PySAM Battery so size is changed in compute()

Updated the PySAMBatteryPerformanceModel so that the input charge rate and storage capacity are used in compute() and simulate() instead of accessing those values from the config. Other changes include:

  • removed the use of BatteryOutputs, removed P_chargeable and P_dischargeable from outputs (they don't appear to be used)
  • Added outputs of battery_charge and battery_discharge: (these are planned to be used in updated tests)
  • Removed unused or unnecessary attributes of the PySAMBatteryPerformanceModel
  • Removed hard-coded numbers and replaced with attributes in the PySAMBatteryPerformanceModelConfig

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 7: New Model Checklist (if applicable)

TODO:

  • Add test to check that battery capacity is changed after setup() (one test with a pyomo controller, one test without a controller)
  • Remove commented out lines of code in pysam_battery.py
  • Update docstrings in pysam_battery.py

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

Implementation feedback:

Other feedback:

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 the Section 6: Test Results)
  • 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 has been updated to describe the changes made in this PR

Section 3: Related Issues

Related to #521

Section 4: Impacted Areas of the Software

Section 4.1: New Files

N/A

Section 4.2: Modified Files

  • h2integrate/storage/battery/pysam_battery.py
    • PySAMBatteryPerformanceModelConfig: What and why something was changed in one sentence or less.
    • PySAMBatteryPerformanceModel
      • setup(): removed P_chargeable and P_dischargeable outputs, added battery_charge and battery_discharge outputs.
      • compute(): removed usage of BatteryOutputs, updated to use the inputs of charge rate and storage capacity rather than accessing those values from the config.
      • simulate(): removed usage of BatteryOutputs, updated to use the inputs of charge rate and storage capacity rather than accessing those values from the config.
  • h2integrate/storage/battery/battery_baseclass.py: updated the input/output setting to use self.n_timesteps instead of copy_shape

Section 5: Additional Supporting Information

Section 6: Test Results, if applicable

@elenya-grant elenya-grant added code cleanup ready for review This PR is ready for input from folks dispatch related to dispatch and control labels Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code cleanup dispatch related to dispatch and control ready for review This PR is ready for input from folks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant