Importing inputs from SAM, Interdependent Variables, SSC versions

  • Lukas Kriechbaum
  • Topic Author
More
03 Apr 2024 11:27 #13050 by Lukas Kriechbaum
Hello,

I'm new to the topic of SAM and PySAM. For importing inputs from SAM the current documentation of PySAM suggests using PySAM JSON exports or JSON for inputs exports. These can than later imported by looping through the contents of the JSON file:
for f, m in zip(file_names, modules):
    with open(dir + f + ".json", 'r') as file:
        data = json.load(file)
        # loop through each key-value pair
        for k, v in data.items():
            if k != "number_inputs":
                m.value(k, v)

However, for older PySAM versions I also found options to use PySSC's dict_to_ssc_table:
json_file_path = 'pvwattsdistcomm.json'
f = open(json_file_path)
dic = json.load(f)
pv_dat = pssc.dict_to_ssc_table(dic, "pvwattsv7")
grid_dat = pssc.dict_to_ssc_table(dic, "grid")
f.close()
pv = PVWatts.wrap(pv_dat)
grid = Grid.from_existing(pv)
grid.assign(Grid.wrap(grid_dat).export())

Which of the three options is the best to use? Which shall be avoided?

For me it was not so easy to find out which SSC my current SAM or PySAM version is using. It could be helpful if PySAM issues a warning if JSON files exported from SAM were created for a different SSC than the one used by the PySAM version.
It would be also nice, if the binaries of the different releases are available on downloads page .
For example PySAM 5.0.0 uses SSC288, the currently available binaries are SAM 2023.12.17 R1 (SSC290). But where can I download SAM 2023.12.17 (SSC288)?


In the examples to the interdependent variables one link refers to a PV System Design.txt file. However, all the text files in this folder have been converted to JSONs.

Many thanks for your answers in advance
Lukas

Please Log in or Create an account to join the conversation.

  • Paul Gilman
More
03 Apr 2024 16:38 #13052 by Paul Gilman
Hi Lukas,

For working with SSC in Python, we recommend using PySAM rather than PySSC.

We've tried to improve version information over time -- I agree there is room for more improvement here.

In SAM, you can see the SSC version by clicking Help, About. You can find the SSC version for any version of SAM in the release notes -- click the button in SAM's Help window or go to nrel.github.io/SAM/doc/releasenotes.html.

For PySAM, you can refer to the Releases page on GitHub: github.com/NREL/pysam/releases, which is referenced on the Versions page of the PySAM documentation: nrel-pysam.readthedocs.io/en/main/versions.html.

SAM does not record the SSC version number in .sam files, and SAM's code generator does not record the ssc version number in the JSON files it creates. SAM is designed to be able to open older .sam files, and PySAM should work with old JSON files -- we try to avoid changing variable names that cause incompatibility issues with old files. An exception to this is the recent change in the "adjust" variable from a table structure that used colons in the variable name to a flat structure that uses underscores, but SSC should generate a helpful error message if you use the old format for one of these variables. (For example, the old 'adjust:constant' variable in Pvsamv1 is now 'adjust_constant'.)

For each version of SAM, we only provide access to the most recent update. For example, for SAM 2023.12.17, we we only provide access to SAM 2023.12.17 r1. We no longer provide access to the original release because it has known bugs that we have fixed.

There is typically a delay between the time we release a new SAM version and when we release the equivalent PySAM version because of the time it takes to build PySAM. This was especially true with the SAM 2023.12.17 release because the new hybrids models in SAM required significant changes to the PySAM build process. As of now, SAM 2023.12.17 r1 is eqivalent to PySAM 5.1.0: Both are based on SSC 290.

Best regards,
Paul.

 

Please Log in or Create an account to join the conversation.

Moderators: Paul Gilman
Powered by Kunena Forum