Skip to content

Update JSON loading and saving to handle NaN and Inf #2047

Merged
sjanzou merged 18 commits into
developfrom
SAM_1856
Apr 3, 2025
Merged

Update JSON loading and saving to handle NaN and Inf #2047
sjanzou merged 18 commits into
developfrom
SAM_1856

Conversation

@sjanzou

@sjanzou sjanzou commented Apr 1, 2025

Copy link
Copy Markdown
Collaborator

Addresses SAM issue #1856 to use Inf values as tier maximum usages.

Fixes #1856

Goes with ssc pull request NatLabRockies/ssc#1309

expected changes in test_results files - doubles are written out to full precision and NaN and Inf are directly supported - expect results to differ slightly.

Checklist

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

PySAM regeneration should be tested

ME Tidal LCOE calculator defaults seems to have an issue in the equations.

@sjanzou sjanzou self-assigned this Apr 1, 2025
@sjanzou sjanzou added this to the SAM Spring 2025 Release milestone Apr 1, 2025

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

image

Energy charges with max usage of 'nan' gives the same results as max usage 'inf'. What does max usage 'nan' represent? Not a super likely use case, just curious

Not sure where this would be relevant, but this also allows for -nan and -inf inputs.

#2043 needs to be merged to fix the ME tidal issue

@sjanzou

sjanzou commented Apr 2, 2025

Copy link
Copy Markdown
Collaborator Author

image

Energy charges with max usage of 'nan' gives the same results as max usage 'inf'. What does max usage 'nan' represent? Not a super likely use case, just curious

Not sure where this would be relevant, but this also allows for -nan and -inf inputs.

#2043 needs to be merged to fix the ME tidal issue

Thanks for testing. The marine-ui-updates branch was merged in to fix the defaults issue.

ssc pull request NatLabRockies/ssc#1309 was created to address the nan, -nan, and -inf handling.

Now, 1e+38 and inf for max tiers gives same result and negative values and NaNs throw errors
image

image

@sjanzou sjanzou requested a review from mjprilliman April 2, 2025 10:10
@cpaulgilman

Copy link
Copy Markdown
Collaborator

This specifically addresses #1856 by adding support for NaN and Inf in the DataMatrix widgets for electricity rate inputs. However, it is not possible to type "Inf" for numeric inputs with default value of 1e38 like incentives. Do we want NaN and Inf to work for all numeric inputs?

image

@sjanzou

sjanzou commented Apr 2, 2025

Copy link
Copy Markdown
Collaborator Author

This specifically addresses #1856 by adding support for NaN and Inf in the DataMatrix widgets for electricity rate inputs. However, it is not possible to type "Inf" for numeric inputs with default value of 1e38 like incentives. Do we want NaN and Inf to work for all numeric inputs?

image

@cpaulgilman , that was the next question (or issue) to replace all 1e+38 with inf in defaults. We now support saving and loading inf and NaN values directly in JSON.

sjanzou added a commit to NatLabRockies/ssc that referenced this pull request Apr 3, 2025
Throw error for NaN (or -NaN) or negative max tier usage.

Merging per 4/2/2025 meeting and per reviews of SAM NatLabRockies/SAM#2047
@sjanzou sjanzou merged commit 228433b into develop Apr 3, 2025
@sjanzou sjanzou deleted the SAM_1856 branch April 3, 2025 06:49
@cpaulgilman cpaulgilman added the added to release notes PR and/or issue has been added to release notes for a public release label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added to release notes PR and/or issue has been added to release notes for a public release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow "inf" as a GUI input options for utility tiers

3 participants