Skip to content

Throw an error if all billing demand periods are zero#1293

Merged
brtietz merged 3 commits into
developfrom
sam_1985_error_message_for_bd_lookback
Mar 17, 2025
Merged

Throw an error if all billing demand periods are zero#1293
brtietz merged 3 commits into
developfrom
sam_1985_error_message_for_bd_lookback

Conversation

@brtietz

@brtietz brtietz commented Mar 10, 2025

Copy link
Copy Markdown
Collaborator

Fixes NatLabRockies/SAM#1985

To test:

  1. Create a PVWatts commercial case
  2. Enable billing demand lookback
  3. Run the case - case should run successfully
  4. Set all "Included in billing demand" values under "billing demand by time-of-use period for demand charges" values to zero
  5. Run the case - new error message should appear.

@brtietz brtietz requested review from cpaulgilman and sjanzou March 10, 2025 18:48
@brtietz brtietz added this to the SAM Spring 2025 Release milestone Mar 10, 2025
@brtietz brtietz self-assigned this Mar 10, 2025
@brtietz

brtietz commented Mar 10, 2025

Copy link
Copy Markdown
Collaborator Author

It looks like the test failure is caused by https://github.com/NREL/ssc/blame/31d4a54a01f2531fbb412aee93e5ac39a973a3ce/test/ssc_test/cmod_utilityrate5_test.cpp#L1717, which was put in place to test the solution to NatLabRockies/SAM#857

That test file has a rate that should be valid, but throws an error on the branch with this code.

Should the lookback periods look at energy charge periods for a case like this? Or do we want to force the user to set up demand charge periods and then set the demand charges to zero?

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

Error message looks good and is repeated twice for emphasis ;-)
image

As far as should the lookback periods look at energy charge periods for a case like this? Or do we want to force the user to set up demand charge periods and then set the demand charges to zero?

Maybe put the onus on the user - if they are using lookback periods, then they should be able to add detailed inputs - @cpaulgilman ?

@cpaulgilman

Copy link
Copy Markdown
Collaborator

As far as should the lookback periods look at energy charge periods for a case like this? Or do we want to force the user to set up demand charge periods and then set the demand charges to zero?

Maybe put the onus on the user - if they are using lookback periods, then they should be able to add detailed inputs - @cpaulgilman ?

I agree with Steve. If billing demand lookback is enabled, then the user should set up the lookback periods correctly (with at least one "Included in Billing Demand (0/1)" set to 1 as per the Help note mentioned in NatLabRockies/SAM#1985).

@brtietz

brtietz commented Mar 13, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks, I've adjusted the test data to reflect that change. Do you recommend any adjustments to the error message (or help) to reflect the change as well? A small number of users will have files that were valid in 2024.12.12 that will not run with this change, and I'm not sure versions.lk is the right way to solve that (too many edge cases, and too much risk of overwriting valid data). "Wait for the forum question" might also be an acceptable answer given how small the number of users might be.

@coveralls

coveralls commented Mar 14, 2025

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 13845597437

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 111 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.002%) to 49.114%

Files with Coverage Reduction New Missed Lines %
ssc/shared/lib_utility_rate_equations.cpp 43 87.79%
ssc/ssc/cmod_utilityrate5.cpp 68 90.98%
Totals Coverage Status
Change from base Build 13837995419: -0.002%
Covered Lines: 65137
Relevant Lines: 132624

💛 - Coveralls

@sjanzou

sjanzou commented Mar 14, 2025

Copy link
Copy Markdown
Collaborator

Thanks, I've adjusted the test data to reflect that change. Do you recommend any adjustments to the error message (or help) to reflect the change as well? A small number of users will have files that were valid in 2024.12.12 that will not run with this change, and I'm not sure versions.lk is the right way to solve that (too many edge cases, and too much risk of overwriting valid data). "Wait for the forum question" might also be an acceptable answer given how small the number of users might be.

@brtietz , I think the error message is fine now and I think the "Wait for the forum question" is appropriate for the small number of users affected. However, I defer to @cpaulgilman for the final verdict.

@brtietz brtietz merged commit 52999c0 into develop Mar 17, 2025
@brtietz brtietz deleted the sam_1985_error_message_for_bd_lookback branch April 18, 2025 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Billing demand lookback with TOU "Included in Billing Demand" of zero causes unexpected results

4 participants