All of the source code and tools required to build SAM are available to the public on the SAM GitHub repositories. NREL will continue to maintain and update the code, and to release NREL versions of SAM for Windows, Mac and Linux with new features and updates.
SAM Open Source is the latest addition to the suite of ways you can use SAM for your research and analysis. It provides:
- Transparency: Explore the source code to find equations and algorithms so you can see exactly how the models work.
- Flexibility: Change the code and build your own versions of SAM to add your own features and capabilities.
- Collaboration: Contribute new models, fix bugs, or work with NREL to implement new features that can be added to the NREL versions of SAM.
To learn more, watch a recording of the SAM Open Source webinar from September 2017.
Are you ready to dig in? Check it out at https://github.com/NREL/SAM.
Do you have a question or suggestion about the open source code? Post a question or comment on the SAM Open Source Forum.
Where do I find SAM's source code?
SAM's source code is hosted on GitHub.com repositories. The main repository is at https://github.com/nrel/sam. See the README and Wiki pages for information about the code repositories and instructions for building and contributing to the project.
What computer language is SAM written in?
Most of SAM is written in C++, and some of the user interface elements are written in LK script. SAM's code uses standard C libraries along with WxWidgets and WEX (an extension of WXWidgets written for SAM) libraries for the user interface, and LK libraries for scripting functionality. See this SAM Open Source wiki page for more about software dependencies.
SAM's open source code is copyrighted by the Alliance for Sustainable Energy and licensed under a BSD-3 clause license. It allows for-profit and not-for-profit organizations to develop and redistribute software based on SAM under the terms of a BSD-3 license.
Will NREL continue to maintain the source code?
Yes. NREL will continue to maintain the source code and to release NREL versions of SAM. NREL will also review contributions before accepting them as part of the open source code base.
Can I build and distribute my own version of SAM?
Yes, as long as you follow the terms of the SAM license.
What other ways can I extend SAM's functionality?
The desktop version of SAM includes tools for more advanced analysis, including parametric and stochastic simulations, P50/P90 analysis, and the built-in LK scripting language for full automated control over assigning inputs, running simulations, reading outputs, and reading and writing data to files. You can also use the SAM API that comes with the SAM SDK to access the SAM Simulation Core (SSC) library and run SAM from your own applications written in C/C++, Python, VBA, MATLAB, PHP, and other languages.