Hi Adam,
There is another consideration when you are comparing results from the SAM desktop application with PySAM results.
SAM and PySAM both interface with the same SAM Simulation Core (SSC) library. SAM's user interface has internal code that calculates the value of several SSC inputs. These "calculated values" appear in blue on the input pages. You cannot edit these values directly. For example, on the Installation Costs page for the PVWatts model, you cannot edit the total installed cost value directly because SAM calculates it from the cost categories for module, inverter, land purchase, etc. When you use the code generator to create the JSON for PySAM files, SAM sets the SSC input total_installed_cost to the calculated value from the SAM user interface.
In SAM, when you change the nameplate capacity on the System Design page, the total installed cost on the Installation Costs page changes. In PySAM, when you change the value of system_capacity, you have to also recalculate the value of total_installed_cost in your Python script. One way to make it easier to make your Python script consistent with SAM is to set all of the cost categories on the Installation Costs page in SAM to zero except for the module $/Wdc cost category, which you can use to represent the total system cost. Then when you export the inputs to JSON for PySAM to use in your Python script, if you modify the system capacity, you can recalculate
total installed cost ($) = module cost ($/Wdc) * system capacity (kW) * 1000 W/kW.
For the Single Owner financial model, there several inputs that depend on the nameplate capacity in addition to the total installed cost. The easiest way to remove these dependencies is to set these inputs to zero and account for their cost in the total installed cost that you calculate in your Python code. These inputs are:
- Sales tax
- Up-front fee (for project term debt)
- Percent of installed cost (for all 5 possible construction period loans)
The attached .sam and .py files demonstrate this approach for a PVWatts / Single Owner case. You can use a similar approach for other models.
To use these files:
- Download the pvwatts-singleowner-for-pysam.sam and pvwattsv8-single-owner-from-sam.py files and put them in an empty folder.
- Start SAM and open the .sam file you just downloaded.
- Note the inputs on the Installation Costs and Financial Parameters input pages.
- On the Case menu, click Generate code, and choose PySAM JSON at the bottom of the list. Save the JSON files to the same folder as the .sam and .py files.
- Run the Python script.
The "Input Consistency Warning" in the PySAM documentation for each compute module attempts to explain this issue. For example, the Single Owner documentation is here:
nrel-pysam.readthedocs.io/en/master/modules/Singleowner.html. The documentation for each input also lists other inputs that depend on its value, for example the construction_financing_cost description on that page. We are in the process of revising the documentation to make this clearer.
Best regards,
Paul.