Skip to content

Conversation

brtietz
Copy link
Collaborator

@brtietz brtietz commented Sep 19, 2025

Pull Request Template

Description

Changes:

  • Convert PVWatts to run in lifetime mode (UI and defaults)
  • Swap to detailed battery model for the PVWatts-Battery Configuration
  • Add FOM configurations for PVWatts-Battery
  • Version upgrade script for the above

Two areas where I could use help:

  1. The version upgrade script doesn't seem to be interpreting the battery chemistry and battery dispatch from the old pvwatts battery mode properly. These should be 0-1, and 0-2 respectively but I'm getting 3 for dispatch in my tests?
  2. The progress bar goes from 0 - 200% for these cases.

Fixes #753 and #2105

Corresponding branches and PRs:

Just SAM, develop for other repos.

Note that #2109 will require some additional defaults changes in these new files, depending on merge order.

Unit Test Impact:

Adds new configurations. Changes to lifetime mode mean defaults in test_results_win64 are expected.

Checklist

  • requires help revision and I added that label
  • adds, removes, modifies, or deletes variables in existing compute modules
  • adds a new compute module
  • changes defaults
  • I've tagged this PR to a milestone

Reminders- this section can be deleted

[Checking for PySAM Incompatible API Changes]
(https://github.com/NREL/SAM/wiki/PySAM-Incompatible-API-Changes-&-Regenerating-PySAM-Files).

  • Adds new configurations, new files generated

[When do the PySAM files need to be regenerated?]
(https://github.com/NREL/SAM/wiki/PySAM-Incompatible-API-Changes-&-Regenerating-PySAM-Files#when-do-the-pysam-files-need-to-be-regenerated-via-export_config)

@brtietz brtietz added this to the SAM Fall 2025 Release milestone Sep 19, 2025
@brtietz brtietz added enhancement pv pvsam1, pvwatts, hcpv battery requires help revision Requires a Help revision before releasing public version labels Sep 19, 2025
Confusing for developers for this to be hidden behind `batt_bank_duration`.
Use `oldvalue()` to load simple battery inputs because those inputs are not in new detailed config.

Add message to variables that are copied from old simple battery inputs.

Set battery size units to AC to be consistent with simple battery.

Replace `batt_bank_duration` with `batt_bank_size_ui` (note confusing widget `batt_bank_duration` was hidden under `batt_bank_size_UI`in UI)

Revise message text.
Copy link
Collaborator

@cpaulgilman cpaulgilman left a comment

Choose a reason for hiding this comment

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

Please change the navigation tree label from "PV" to "PVWatts" to distinguish between Detailed PV and PVWatts models and for consistency with Hybrid configurations.

@cpaulgilman
Copy link
Collaborator

@brtietz I made some changes to the Version Upgrade script to fix the problems you described and a couple of others. Please test and let me know if you notice other issues.

One unresolved item is that opening an old PVWatts-Battery file with lead acid battery does not correctly set the battery lifetime options. I think we want to load battery defaults for the chemistry and then apply the input from the old file, but not sure of the best way to do that.

@brtietz
Copy link
Collaborator Author

brtietz commented Sep 24, 2025

@cpaulgilman Thanks for those fixes and feedback!

I pulled the appropriate code from the UI forms into the version upgrade script to fully handle the chemistry transition between lead acid flooded and Li-ion NMC. This seemed better than hardcoding the variables in cmod_battwatts, and trying to force the upgrade script and UI form to work together (which resulted in "on load" overwriting user values when I tried it). Does this seem reasonable to you?

I also found and fixed an error with the exclusive forms in the dispatch upgrades, and made the nav tree change you requested.

Copy link
Collaborator

@cpaulgilman cpaulgilman left a comment

Choose a reason for hiding this comment

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

Thanks for these changes. Navigation menu looks good, and battery defaults are consistent with battery type.

@brtietz brtietz merged commit d0c70b2 into develop Sep 24, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

battery enhancement pv pvsam1, pvwatts, hcpv requires help revision Requires a Help revision before releasing public version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Lifetime Mode for PVWatts

2 participants