Importing JSON Input files into PVSAMV1

  • pgilman
More
18 Apr 2023 17:27 #12063 by pgilman
Replied by pgilman on topic Importing JSON Input files into PVSAMV1
When you get 'AttributeError', one thing to check is that the version of SAM you are using matches the PySAM version.

You can find a list of PySAM releases with their associated SAM and SSC versions here: github.com/NREL/pysam/releases

Paco, in your case, please check the untitled_pvsamv1.json file to make sure the subarray1_shading_string_option variable is defined. If you continue to have trouble, please attach a copy of the .json file so I can help troubleshoot.

Best regards,
Paul.

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

  • sav
More
25 Apr 2023 07:18 #12073 by sav
Replied by sav on topic Importing JSON Input files into PVSAMV1

File Attachment:

File Name: Lysabild_pvsamv1.txt
File Size:230 KB

File Attachment:

File Name: Lysabild_grid.txt
File Size:0 KB

Hi Paul,
I'm having the same issue as Paco. I've checked the versions of SAM and PySAM and they are a match. Attached is the json used and a screenshot of the code. I've checked inside the Pvsamv1 library and indeed the "subarray1_string_option" is not defined inside this library.
How can we solve this issue?
The model in SAM is: Detailed PV Model with no financial model.
Kind regards,
Sarah 

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

  • pgilman
More
25 Apr 2023 16:33 #12077 by pgilman
Replied by pgilman on topic Importing JSON Input files into PVSAMV1
Hi Sarah,

Attached is a zip file that I created from a default Detailed PV / No Financial case in SAM. It includes the json input files for the Pvsamv1 and Grid modules, a weather file, and a sample Python script that runs a simulation.

Without seeing all of the files you are using, it's hard for me to tell what is causing the error message you are seeing, but hopefully these files will help you troubleshoot:

 

File Attachment:

File Name: pysam-pvsamv1.zip
File Size:111 KB


Best regards,
Paul.

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

  • sav
More
27 Apr 2023 01:27 #12082 by sav
Replied by sav on topic Importing JSON Input files into PVSAMV1
Hi Paul,

I checked your JSON file, and I see that you don't have "subarray1_string_option". I think that the difference is that in SAM I imported shade loss table, so this attribute comes in the JSON but is nowhere defined on Pvsamv1. Should I use a different model when modeling with shade loss table?

Kind regards,
Sarah Vilete

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

  • pgilman
More
27 Apr 2023 11:54 #12087 by pgilman
Replied by pgilman on topic Importing JSON Input files into PVSAMV1
Hi Sarah,

I think the problem is due to the shading inputs.

There are two sets of inputs to SSC (the library behind PySAM) that use colons in the variable names. These names are acceptable in C++ but not in Python.

For Pysamv1, they are the following inputs for shading (this list is for Subarray 1, but there are similar ones for Subarrays 2, 3, and 4) on SAM's Shading and Layout input page when you click the Edit Shading button for a subarray:

subarray1_shading:string_option
subarray1_shading:timestep
subarray1_shading:mxh
subarray1_shading:azal
subarray1_shading:diff

And for AC and DC losses on SAM's Losses input page under "System Availability":

adjust:constant
adjust:hourly
adjust:timeindex
adjust:periods

dc_adjust:constant
dc_adjust:hourly
dc_adjust:timeindex
dc_adjust:periods

For the loss inputs, PySAM's AdjustmentFactors group handles these variable names with colons, but, as far as I can tell, there is not a similar function for the shading inputs.

We are making changes to SSC to eliminate variable names with colons that will be part of the Fall 2023 release.

In the meantime, you can work around this issue in PySAM by applying the shading factors yourself to the beam and diffuse irradiance data in your weather file.

Best regards,
Paul.






 

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

  • pgilman
More
28 Apr 2023 16:23 - 28 Apr 2023 16:25 #12091 by pgilman
Replied by pgilman on topic Importing JSON Input files into PVSAMV1
Hi Sarah,

I am following up on this problem with exporting Pvsamv1 shading variables from SAM with a better solution.

SAM's code generator exports shading variables with the following names from a Detailed PV case, depending on what shading options are enabled:
Code:
subarray1_string_option subarray1_timestep subarray1_mxh subarray1_azal subarray1_diff

However, PySAM expects the following variable names for Pvsamv1:
Code:
subarray1_shading_string_option subarray1_shading_timestep subarray1_shading_mxh subarray1_shading_azal subarray1_shading_diff

You can fix the problem by editing those variable names in the JSON file created by SAM's code generator, or by assigning values to those variables in your Python code before running Pvsamv1.

In the attached .zip archive, I included a Python script that automatically fixes the Pvsamv1 shading variable names before assigning them.

Thank you for bringing this problem to our attention. We will fix it for the Fall 2023 version of SAM: github.com/NREL/SAM/issues/1395 .

Best regards,
Paul.
Last edit: 28 Apr 2023 16:25 by pgilman.

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

Moderators: pgilman
Powered by Kunena Forum