Hi Katie,
Thank you for sending those files. The most common cause of differences between PySAM and SAM results is a difference in one or more inputs. The following are potential causes of differences in the files you shared:
1. Make sure you are using versions of SAM and PySAM that are based on the same version of SSC.
The .sam file was created and saved in SAM 2020.11.29, which is based on SSC version 256. The current Version of SAM is SAM 2021.20.02 Revision 1, which is based on SSC Version 268. You can find the version number of SSC for your version of SAM by clicking the Help button and then clicking About at the top of the Help window.
The current version of PySAM is 3.0.1, and it runs SSC Version 268. You can use the following script to check the PySAM and SSC versions:
import PySAM as pysam
import PySAM.PySSC as pssc
print('PySAM Version', pysam.__version__)
ssc = pssc.PySSC()
print('SSC version', ssc.version())
2. Make sure you are using the same configuration in SAM and PySAM.
The SAM file you shared uses the Generic-Battery / Residential configuration. You can see that in the top left corner of the SAM window:
Attachment sam-config.png not found
In Python, it looks like you are using the Standalone Battery / Residential configuration:
Attachment python-config.png not found
3. Make sure the inputs you are using in SAM are consistent with those in Python.
This can be tricky to ensure. The best way to be sure you are comparing consistent inputs is to set up your analysis in SAM, and then export the SAM inputs to JSON files and import those into your Python script. Export to JSON using a process similar to the one demonstrated in this video, except use
PySAM JSON code generator option:
Attachment code-generator.png not found
Then use the method described in the PySAM documentation to import the data from JSON:
nrel-pysam.readthedocs.io/en/master/Import.html
When you are sure the inputs are consistent, you still may see small differences in output values due to differences in numerical precision in the underlying code, but the results should be pretty close to identical.
Let me know if you need more help identifying the cause of differences between specific outputs in SAM and PySAM.
Best regards,
Paul.