Enable compatibility with NREL-PySAM v6 and v7#219
Merged
genevievestarke merged 2 commits intoNatLabRockies:developfrom Mar 4, 2026
Merged
Enable compatibility with NREL-PySAM v6 and v7#219genevievestarke merged 2 commits intoNatLabRockies:developfrom
NREL-PySAM v6 and v7#219genevievestarke merged 2 commits intoNatLabRockies:developfrom
Conversation
Collaborator
|
I think that could work, I think I added those lines when tinkering with this module and not sure how critical. Maybe @brookeslawski would you mind to give this change a look over? |
elenya-grant
reviewed
Mar 4, 2026
|
|
||
| system_model.AdjustmentFactors.adjust_constant = 0 | ||
| system_model.AdjustmentFactors.dc_adjust_constant = 0 | ||
| try: |
Collaborator
There was a problem hiding this comment.
if you want to keep backward compatibility with PySAM v6 you could do:
import PySAM
if int(PySAM.__version__.split(".")[0]) < 7:
system_model.AdjustmentFactors.dc_adjust_constant = 0instead of the try-except
Collaborator
Author
There was a problem hiding this comment.
Going to see whether running with v6 with these lines just removed still passes tests
Collaborator
Author
|
Ok, I've now simply removed the two lines that caused issues. Tests still pass, and example 03 still provides (visually) the same output, so perhaps that's good enough? |
Merged
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.
Currently, Hercules requires
NREL-PySAM v6. However, v7 was released in April 2025 and the latest version is v7.1.0 (released August 2025).Hercules, as is, is not compatible with v7 of
NREL-PySAM. This "fixes" this by adding a couple oftry/exceptclauses on a few lines that generate errors. However, I am not sure if this is a legitimate fix or if I am changing the behavior.With the update:
Using v6.0.1:

Using v7.1.0:

Assuming we no longer need to use the lines that are
excepted in this change, we could simply require v7. However, this is a change that will affect users directly, as they'll need to update their local environments to keep using Hercules. The change I've implemented here allows users to stay on v6, or to move up to v7.If a valid correction, addresses #218