adjust:constant input not found for PVWatts module

  • Thore Müller
  • Topic Author
More
09 Aug 2021 22:25 #9918 by Thore Müller
Hello, 

I am trying to get into using SAM in python and I am trying to repeat the To import a case from the SAM GUI  example in the documentation. 

in my example (see code attached) I try to read from a file pvwatts_default-inputs.json, which I have created from the SAM GUI (export -> json inputs and separating what I believe is part of the grid module). 

The file looks like this: 
{
    [...], 
    "adjust:constant" : 0
}


When I try to execute with the "adjust:constant" variable included I get an "AttributeError", which I believe is because it does not recognize the variable name. And indeed in the C++ source code  there is no variable with that name. 
When I remove the variable, I get "Exception: pvwattsv7 execution error. precheck input: variable 'adjust:constant' (Constant loss adjustment) required but not assigned"

Attachments: code example and two .json input files (.json files not allowed as attachements, therefore as .txt)

Thank you in advance for any hints on the solution and please excuse the beginner level question!

Additional questions out of interest: 
1) Why does the example exclude a variable with the name "number_inputs"?
2) The C++ source code mentions a lot more inputs (such as "bifaciality") than are being generated when exporting inputs to .json in SAM, why is that?

Attachment not found

Attachment not found

Attachment not found


3) When exporting the SAM inputs to a .json file the file also includes the following lines. What are they used for, they do not appear to be either PVWatts or Grid inputs.

"metric_0" : "annual_energy",
"metric_0_label" : "Annual energy (year 1)",
"metric_1" : "capacity_factor",
"metric_1_label" : "Capacity factor (year 1)",
"metric_2" : "kwh_per_kw",
"metric_2_label" : "Energy yield (year 1)",
"number_compute_modules" : 2,
"number_metrics" : 3

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

  • Paul Gilman
More
17 Aug 2021 16:41 - 17 Aug 2021 16:41 #9959 by Paul Gilman
Replied by Paul Gilman on topic adjust:constant input not found for PVWatts module
Hi Thore,

To use the SAM Code Generator with PySAM, export using the "PySAM JSON" at the bottom of the Code Language window instead of the "JSON for inputs" option. PySAM recognizes the input variable constant instead of adjust:constant. The following JSON inputs for the PVWattsv7 module should work:

{
    "solar_resource_file" : "C:/SAM/2020.11.29/solar_resource/fargo_nd_46.9_-96.8_mts1_60_tmy.csv",
    "system_capacity" : 4,
    "module_type" : 0,
    "dc_ac_ratio" : 1.2,
    "array_type" : 0,
    "tilt" : 20,
    "azimuth" : 180,
    "gcr" : 0.40000000000000002,
    "losses" : 14.075660705566406,
    "en_snowloss" : 0,
    "inv_eff" : 96,
    "batt_simple_enable" : 0,
    "constant" : 0
}

I don't know about the number_inputs. Can you show me where you found that example?

Best regards,
Paul.
Last edit: 17 Aug 2021 16:41 by Paul Gilman.

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

Moderators: Paul Gilman
Powered by Kunena Forum