PySAM vs SAM

  • Fernando Estevez
  • Topic Author
  • New Member
  • New Member
More
03 Aug 2021 00:46 #9902 by Fernando Estevez
PySAM vs SAM was created by Fernando Estevez
Hello,
I have been using PySAM as a wrapper to make calls to the SAM simulation core compute modules. I model my solar panel performance through the GUI application and compared it with the PySAM output. I noticed that it wasn't exactly the same but was relatively close. I took a look at PySAM's documentation and under "Possible Problems" it says that I have tp provide my own calculations as PySAM doesn't handle it like the GUI application. Diving into the C++ code on GitHub, I located the areas where calculations are being made. My question is that if PySAM is a wrapper to the SAM simulation core model, when I call the execute() in PySAM does it make the call to the C++ library? If so all calculations done within the execute() function in the C++ library should be done when I call it through my python call? or why would my outputs differ? 

For some reference, I am using the Detailed PV Model - Residential Owner and I call the execute function on the pvsamv1.execute().

Thank you,
Fernando Estevez 

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

  • Paul Gilman
  • Paul Gilman's Avatar
  • Platinum Member
  • Platinum Member
More
03 Aug 2021 15:31 #9908 by Paul Gilman
Replied by Paul Gilman on topic PySAM vs SAM
Hi Fernando,

PySAM is a Python wrapper for SSC (SAM Simulation Core), which is a large collection of code written in C++ in the github.com/nrel/ssc code repository.

The desktop application SAM integrates SSC into a user interface, and uses the code repositories listed here: github.com/nrel/sam .

When comparing results from SAM and PySAM, as long as the inputs to SSC are identical, you should get identical results. You can use SAM's code generator to generate a set of SSC inputs from the SAM user interface to help be sure all of the inputs are identical. This is described here: sam.nrel.gov/software-development-kit-sdk

SAM includes some code in the user interface that is not part of SSC. For example, the Detailed PV model in SAM has an option for SAM to automatically calculate the number of modules per string and number of strings in parallel for a given desired DC array capacity: That code is part of the user interface but not SSC.

You may find small differences in results between PySAM and SAM caused by rounding differences.

Best regards,
Paul.

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

  • Fernando Estevez
  • Topic Author
  • New Member
  • New Member
More
03 Aug 2021 19:25 #9910 by Fernando Estevez
Replied by Fernando Estevez on topic PySAM vs SAM
Hi Paul,

Thank you for a quick response, that makes sense. I went ahead and generated a set of SSC inputs from the SAM user interface to use it to cross reference my PySAM code. I noticed some variables such as spe_area, 6par_aisc, 6par_bvoc, cec_area, cec_i_mp_ref, etc, that I do not updated on my PySAM code. Are these variables that the SAM GUI automatically calculates and updates? When I was looking through the documentation for the SystemDesign Group it states that "This variable may need to be updated if the values of the following have changed".

Thank you,
Fernando Estevez

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

  • Paul Gilman
  • Paul Gilman's Avatar
  • Platinum Member
  • Platinum Member
More
04 Aug 2021 18:19 #9912 by Paul Gilman
Replied by Paul Gilman on topic PySAM vs SAM
Hi Fernando,

The pvsamv1 SSC module has many optional inputs that depend on choices you make. For example, the "spe_" inputs are for the Simple Efficiency Module Model option (SPE stands for "Single Point Efficiency"), so would only be required if you use that option.

That note in the PySAM documentation is intended to help you identify input variables that are calculated in the SAM user interface.

Best regards,
Paul.

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

Moderators: Paul Gilman
Powered by Kunena Forum