sam open source banner

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

Do you have a question or suggestion about the open source code? Post a question or comment on the SAM Open Source Forum.

Do you love SAM? Are you super excited that it is now open source? This email address is being protected from spambots. You need JavaScript enabled to view it. what you are doing with it and how it has helped you! Testimonials like yours help us secure funding to continue to develop this great tool.


Are you new to SAM? Check out our home page or download the desktop version to learn more about the many other ways that SAM can help you in your research, analysis, and development!

Where do I find SAM's source code?
SAM's source code is hosted on repositories. The main repository is at 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.

How is SAM licensed?
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.

PySAM is a Python wrapper for SAM that you can use to write Python code that makes calls to the SAM Simulation Core (SSC) compute modules. It provides access for tools for accessing SAM default values and input variables so you can create code directly in Python without having to run SAM's code generator.

  • Provides a wrapper around the SAM library that groups together the C API functions by technology or financial model into modules.
  • Includes error-checking, explicit input and output definition, and conversion between Python data types.
  • PySAM modules are compatible with PySSC, which is included as a subpackage. PySSC is the original wrapper used by SAM's code generator.
  • Automatically assign default values to input parameters from SAM's default value database.
  • Built-in documentation of models and parameters.
  • Minimum Python 3.5 for Windows 7 64-bit, MacOSX 10.6, or CentOS 5.

For more information:

PySAM Webinar

This overview presented on August 2, 2019 demonstrates how to use PySAM to build a renewable energy system model in Python using PySAM.

Note. The examples in this video use PySAM 1.2 with pvwattsv5. The example script provided here will not work with newer versions of PySAM with pvwattsv7. For more up-to-date examples, see the PySAM documentation.

Supporting Materials

This page is for information about and links to teaching materials used for academic courses that involve SAM. If you would like to share materials for courses you teach, please contact us.

For links to presentation materials and sample files used by NREL for SAM webinars, please see the relevant Videos page from the website nagivation menu. For example, materials for webinars we have given on modeling PV system are available on the PV Videos page.

The Pennsylvania State University

Solar Resource Assessment and Economics (EME 810) is a graduate-level course for the Renewable Energy and Sustainability Systems (RESS) Program Solar Option.

Course resources for this and other RESS courses are  Open Educational Resources via Creative Commons Share-Alike 3.0 licensing (per Dutton e-Education Institute at Penn State). Three solar courses are open now for sharing (EME 810, 811, and 812, and AE 868), along with several other key RESS courses are related to policy, technologies, and markets.

University of Wyoming Extension

The following Solar Electric Investment Analysis (B-1291) series was developed by Milton Geiger (University of Wyoming), Eric Romich (Ohio State University), and Benjamin Rashford (University of Wyoming) and is available under a Creative Commons Attribution Non-Commercial 4.0 license (International) with permission granted to "share, copy, and redistribute the material in any medium or format and adapt, remix, transform, and build upon the material for any purpose other than commercial, under the following terms: Attribution  You must give the appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner but not in any way that suggests the licensor endorses you or your use."

These materials provide information to help agricultural landowners make informed decisions about investing in photovoltaic power systems for behind-the-meter applications. Each part in the series is a short bulletin focusing on one aspect of the decision-making process. The bulletins cover technical and economic topics. Part 6 is an example using SAM.

This series has been also been adapted by John Hay (University of Nebraska).

SAM is widely used for projects and research outside of the United States. This page provides information about work done by the NREL SAM team and other organizations with a specific focus on features, sample files, and access to data for SAM around the world.

For information about where to find weather data to use with SAM, please see the Weather Data page. You can also search this website to find support forum discussions about specific countries, or about other aspects of the model.

India: Weather Data and Project Finance Models

The SAM team has participated in the  Solar Energy Research Institute for India and the United States (SERIIUS) partnership between the U.S. Department of Energy Sunshot Initiative and India's Jawaharlal Nehru National Solar Energy Mission to support their vision of cooperation and innovation to develop solar electricity technologies.

This work has resulted in the following new features being added to SAM:

  • Access to NREL National Solar Radiation Database (NSRDB) weather data for India directly from the SAM user interface.
  • Modeling of  income tax holidays, receivables reserves, and return on equity in SAM's project cash flow models.
  • A getting started wizard that automatically populates SAM inputs with values appropriate for projects in India.

Mexico: Electricity Rate Data and Distributed Generation Research

NREL staff have been using SAM's electricity metering and billing capabilities to explore compensation mechanisms for Mexico designed to promote deployment of photovoltaic distributed generation projects. This work is part of the 21st Century Power Partnership (21CPP) with the U.S. Agency for International Development and the Clean Energy Ministerial.

  • Zinaman, O.; Aznar, A.; McCall, J. (2018) Informing Mexico's Distributed Generation Policy with System Advisor Model (SAM) Analysis. National Renewable Energy Laboratory. NREL/TP-7A40-71038. (PDF 913 KB)
  • McCall, J. (2018) SAM International Case Studies: DPV Analysis in Mexico. Presented as part of the International Solar Energy Society (ISES) Webinar February 26, 2017.  (PDF 446 KB)
  • Annotated sample SAM file with input values for a typical residential photovoltaic system in Guadalajara, Mexico. Weather data is from the NREL National Solar Radiation Database (NSRDB). Cost, loan parameters, electric load data, and tax parameters were collected in August 2017 in consultation with the Mexican Government Ministry of Energy (SENER) and the Trust for Energy Conservation (FIDE) and Mexico's electricity distribution company (CFE). All cost and electricity rate values in SAM are in pesos ($MXN). Note that the solar costs and electric load data are averages for the Guadalajara region. This file is a suitable starting point for analysis of a project in Mexico. Please review and modify the inputs as appropriate for your analysis. See notes in the file for more details. (SAM 120 KB)
  • Electricity rate data for Mexico is available on NREL's  OpenEI International Utility Rate Database, and can be downloaded directly from the SAM user interface.

Australia: Concentrating Solar Power Sample Files and Weather Data

The Australian Solar Thermal Energy Association (AUSTELA) with the support of Australian Renewable Energy Agency developed a guide with a set of sample files and solar resource data to support the development of concentrating solar power projects in Australia. ITP Renewables developed the materials, and the SAM team reviewed documents and tested SAM files.

this is to test various ways to include links to things within the content.  note, this will make the sea horse picture appear when the page gets loaded.

Creating a link to an article (on biomass combustion):  click me - with the link dialog box, used the main panel to find an article to include.

Creating a link to an image (seahorse):  picture me - with the link dialog box, used the browse button (next to the URL field) to find a file.


Creating a link to a file for download (SAM test txt file):  file me - with the link dialog box, used the browse button (next to the URL field).  Uploaded a test file and selected it. 

  • HOWEVER, this will just display the file. To make it downloadable, need to edit the source and add download to the link
  • This approach will allow you to make txt files downloadable (as well as other kinds of files)


Creating a link to a file for download (SAM test xlsx file):  xlsxfile me again - with the "Insert File" dialog box, used the browse button (next to the URL field).  

  • This won't allow certain types of files (eg .txt), but you can use the dialog options to do just about everything, including adding an icon to the left of the link.


Creating a link to a docman category (2017.9-linux):  doc it -    folder SAM 2017.9.5 Versions  - with the "Document" button below the edit panel, selected a SAM category.

Creating a link to a docman document (2017.9-linux):  doc it -    SAM 2017.9.5 for Linux Document (234.52 MB)  - with the "Document" button below the edit panel, selected a SAM document.

Creating a link to a docman file (2017.9-linux):  doc it -    SAM 2015.1.30 Mac dmg file (189.86 MB)  - with the "Document" button below the edit panel, selected a SAM docman file.


 You can see the page at: