Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import json as SAM case #1325

Merged
merged 108 commits into from
May 4, 2023
Merged

Import json as SAM case #1325

merged 108 commits into from
May 4, 2023

Conversation

tyneises
Copy link
Collaborator

@tyneises tyneises commented Jan 19, 2023

This pull requests adds functionality to import jsons as a SAM case. The molten salt power tower (MSPT) model UI pages and cmod have been updated so that a user can export a MSPT case as a json and then import that json as a new SAM case without any changes or loss of functionality.

Some notable modifications include:

  • Convert 9 independent TOD user inputs into an "array" widget that directly stores the information as an array data type. We've implemented this change on the following UI pages: the Revenue page: TOD table, MSPT Dispatch: Turbine fraction table and Hybrid cooling table
  • Add information for drop down variables that 1) gives the correspond SSC variable name and 2) translates from a 0-based index to the integer code corresponding to the drop down option. This allows the json import to use the compute module value and replaces the index-to-code translation in the UI Equations window. We've updated the MSPT UI to use the new variable info and removed the old translation equations.
  • Add keyboard shortcuts to perform various export/import functions

@sjanzou Please add anything I'm missing

Type of change

Corresponds to SSC pull request: NREL/ssc#969

tyneises and others added 30 commits October 5, 2022 10:05
Modification of JSON for inputs code generation
Goes with Ctrl+F5 saving a case a JSON
… in file

Example of mapping ssc inputs to SAM UI variables included in case.cpp lines 869-877
Implement in VarInfo class persistence and in IDE User Interface and test loading and saving for rec_htf.
Tested loading, running and saving JSON for inputs for ssc variable "htf_rec" and SAM UI variable "csp.pt.rec.htf_type"
@brtietz
Copy link
Collaborator

brtietz commented Apr 17, 2023

My first test of this code was to build PySAM and run the PySAM tests, and 3 of those are failing due to the adjust variable:

image

I can see the variable in the defaults, but it is not being exported to the PySAM defaults with export_config, even after a clean build.

@cpaulgilman
Copy link
Collaborator

cpaulgilman commented Apr 17, 2023

  1. I made a list of variables that need to be handled by the version upgrade script. Should I update the script for this pull request, or do that separately after this has been merged into Develop?

  2. The 3D Shade Calculator causes a callback error: In this test file, go to Shading and Layout page, click Open 3D shade calculator, click Save and Close, and then Yes to update time series losses to see callback error:

Could not evaluate callback function:edit_3d_scene->on_change
[218]: error in call to 'value()': data type mismatch attempting to set 'subarray1_shading' (number) to { string_option=0 en_timestep=1 timestep=[ [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 0, 0, 100 ], [ 0, 0, 100 ], [ 0, 0, 0 ], [ 0, 0, 42.0093 ], [ 0, 0, 100 ], [ 17.9889, 0, 99.9857 ], [ 50.0738, 0, 100 ], [ 87.8075, 100, 50.6341 ], [ 100, 100, 1.41725 ], [ 100, 100, 100[191]: eval error in statement list
[110]: eval error in statement list
[94]: eval error in statement list

@sjanzou
Copy link
Collaborator

sjanzou commented Apr 18, 2023

My first test of this code was to build PySAM and run the PySAM tests, and 3 of those are failing due to the adjust variable:

image

I can see the variable in the defaults, but it is not being exported to the PySAM defaults with export_config, even after a clean build.

Is this a SAM or PySAM issue? The fix would be in export_config which has nothing to do with SAM. Where should I put this issue?

@sjanzou
Copy link
Collaborator

sjanzou commented Apr 18, 2023

  1. I made a list of variables that need to be handled by the version upgrade script. Should I update the script for this pull request, or do that separately after this has been merged into Develop?
  2. The 3D Shade Calculator causes a callback error: In this test file, go to Shading and Layout page, click Open 3D shade calculator, click Save and Close, and then Yes to update time series losses to see callback error:
Could not evaluate callback function:edit_3d_scene->on_change
[218]: error in call to 'value()': data type mismatch attempting to set 'subarray1_shading' (number) to { string_option=0 en_timestep=1 timestep=[ [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 100, 100, 100 ], [ 0, 0, 100 ], [ 0, 0, 100 ], [ 0, 0, 0 ], [ 0, 0, 42.0093 ], [ 0, 0, 100 ], [ 17.9889, 0, 99.9857 ], [ 50.0738, 0, 100 ], [ 87.8075, 100, 50.6341 ], [ 100, 100, 1.41725 ], [ 100, 100, 100[191]: eval error in statement list
[110]: eval error in statement list
[94]: eval error in statement list

I think the version upgrade changes should be in a separate pull request after this pull request is merged into develop.

Thanks for reporting the 3-D shading tool error!

@brtietz
Copy link
Collaborator

brtietz commented Apr 18, 2023

My first test of this code was to build PySAM and run the PySAM tests, and 3 of those are failing due to the adjust variable:
image
I can see the variable in the defaults, but it is not being exported to the PySAM defaults with export_config, even after a clean build.

Is this a SAM or PySAM issue? The fix would be in export_config which has nothing to do with SAM. Where should I put this issue?

Do we typically file bugs related to pull requests, before they hit patch or develop? I view this as a downstream issue created by this PR (in code that lives in the SAM repository), therefore this should be fixed prior to merging here.

@sjanzou
Copy link
Collaborator

sjanzou commented Apr 24, 2023

@brtietz, @dguittet All pysam tests passing with ssc pull request 969, SAM pull request 1325 and pysam pull request 146

Goes with pysam branch adjustment_factors_update and pysam pull request 146
@brtietz
Copy link
Collaborator

brtietz commented Apr 24, 2023

@sjanzou Thanks for fixing!

@tyneises It looks like the current failure on GH Actions is related to the ETES model getting stuck, at least based on what happens when I try to run test_script_ow.lk locally. Can you look into this?

@tyneises
Copy link
Collaborator Author

tyneises commented Apr 24, 2023

@sjanzou Thanks for fixing!

@tyneises It looks like the current failure on GH Actions is related to the ETES model getting stuck, at least based on what happens when I try to run test_script_ow.lk locally. Can you look into this?

@sjanzou technologies that call #ssc_auto_exec with sim_type = 2 from the UI equations window are failing (ETES, PTES, MSPT). The title of the error message suggests that this has something to do with "adjust". Any ideas?

image

@sjanzou sjanzou merged commit 8a038ad into develop May 4, 2023
4 checks passed
@sjanzou sjanzou deleted the mspt_no_finance branch May 4, 2023 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants