Adding charge and discharge efficiency to pysam battery model#699
Open
johnjasa wants to merge 6 commits intoNatLabRockies:developfrom
Open
Adding charge and discharge efficiency to pysam battery model#699johnjasa wants to merge 6 commits intoNatLabRockies:developfrom
johnjasa wants to merge 6 commits intoNatLabRockies:developfrom
Conversation
elenya-grant
requested changes
Apr 24, 2026
Collaborator
elenya-grant
left a comment
There was a problem hiding this comment.
I think that these should be applied internal to the PySAM battery model.
The PySAM battery input parameters, batt_losses_charging and batt_losses_discharging could be set based on the user-input charge and discharge efficiency.
If the charge and discharge efficiency are going to be added to the PySAM storage model - these attributes could now be added to the StoragePerformanceBaseConfig (same with the corresponding __attrs_post_init__ logic)
Collaborator
Author
|
Chatting about this now with Elenya, action items for me on the PR:
|
Collaborator
Author
|
Elenya will see if she can get the correct way to use the pySAM internal args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add charge and discharge efficiencies to PySAM battery performance model
Charge and discharge efficiencies set in the dispatch configuration are now applied in the
PySAMBatteryPerformanceModel.simulate()method. Previously, these efficiencies were used in the Pyomo dispatch SOC inventory constraint but were not reflected in the PySAM battery performance output, causing a mismatch between planned dispatch and actual performance.The fix adds
charge_efficiency,discharge_efficiency, andround_trip_efficiencyparameters toPySAMBatteryPerformanceModelConfig. These are applied on top of PySAM's internal chemistry-based losses when computing the battery output power. When no efficiencies are specified, both default to 1.0, preserving backward compatibility.Would it be more appropriate to use this efficiency value in pySAM instead?
https://nrel-pysam.readthedocs.io/en/main/modules/Battery.html#PySAM.Battery.Battery.BatterySystem.batt_dc_ac_efficiency
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.md"A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
XYZshould be replaced with the actual number.Section 4: Related Issues
Hopefully resolves #474
Section 5: Impacted Areas of the Software
Section 5.1: New Files
None.
Section 5.2: Modified Files
See files tab
Section 6: Additional Supporting Information
PySAM does not expose charge/discharge efficiency as a configurable parameter - efficiency is determined internally by the battery chemistry. The efficiencies added here are applied as an external scaling on top of PySAM's output, matching the convention used by the Pyomo dispatch SOC inventory constraint and the generic
StoragePerformanceModel.Section 7: Test Results, if applicable
All 5 tests in
test_pysam_battery.pypass (26 subtests total), including the newtest_pysam_battery_charge_discharge_efficiencytest and all existing regression tests.