Skip to content

Removed system_model attribute from wind and solar PySAM models - #909

Merged
johnjasa merged 7 commits into
NatLabRockies:developfrom
elenya-grant:minor_pysam_fix
Oct 8, 2026
Merged

johnjasa merged 7 commits into
NatLabRockies:developfrom
elenya-grant:minor_pysam_fix

Conversation

@elenya-grant

@elenya-grant elenya-grant commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Removed system_model attribute from wind and solar PySAM models

Both the pysam wind and pysam solar models were using an attribute self.system_model to simulate performance, this attribute used to be instantiated in setup() and was only modified in compute(). This means that any modifications to self.system_model during subsequent calls to compute() could result in different performance than if compute() was only called once, depending on how the object has been modified. I am not sure that either code did meaningfully modify the system_model attribute in a way that would result in this behavior, but this at least prevents that possibility.

Also! Updated the recalculate_power_curve() to have "success" based on a tolerance rather than an exact ==.

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:

  • figure out what to do about the unusable post_process() method in the pysam wind model based on recent changes
  • Step 2

Type of Reviewer Feedback Requested (on Draft PR)

Structural feedback:

  • Is this change worth it or no? If so, should the other pysam models be updated similarly?
  • What if I just removed the entire post_process() method in the pysam wind model? Or should I set class attributes to be the turbine x/y positions in the pysam wind model (those attributes would only be used by post-process ... which feels silly)

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
    • At least one complete sentence has been provided to describe the changes made in this PR
    • After the above, a hyperlink has been provided to the PR using the following format:
      "A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
      XYZ should be replaced with the actual number.

Section 4: Related Issues

Section 5: Impacted Areas of the Software

Section 5.1: New Files

None

Section 5.2: Modified Files

  • h2integrate/converters/wind/wind_pysam.py
    • recalculate_power_curve(): added system_model as an input
    • setup(): removed creation of system_model attribute
    • compute(): updated to make system_model object
  • h2integrate/converters/solar/solar_pysam.py
    • get_initial_angle_value(): added system_model as an input
    • setup(): removed creation of system_model attribute
    • compute(): updated to make system_model object

Section 6: Additional Supporting Information

Section 7: Test Results, if applicable

@elenya-grant
elenya-grant requested a review from kbrunik October 7, 2026 22:20
@elenya-grant
elenya-grant marked this pull request as ready for review October 7, 2026 22:36
@elenya-grant
elenya-grant requested a review from johnjasa October 7, 2026 22:38
@elenya-grant elenya-grant added the ready for review This PR is ready for input from folks label Oct 7, 2026

@johnjasa johnjasa 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.

Thanks for this, Elenya! I like the simplification and test addition. I did some more cleanup in the setup() methods to remove unnecessary instantiation of the models. Will approve and merge now!

@johnjasa
johnjasa enabled auto-merge October 8, 2026 03:25
@johnjasa
johnjasa merged commit 9c733fb into NatLabRockies:develop Oct 8, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review This PR is ready for input from folks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants