Skip to content

NREL/SAM

patch
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

* Migrate from wtk-srw-download to wtk-download

* Adds option to download subhourly wind resource data

* Fix intervals list

* Clean up WIND Toolkit download messages

* Fix string declarations and typo
36b5ee2

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
December 28, 2017 05:22
December 12, 2022 09:37
November 10, 2020 14:11
November 11, 2022 09:35

System Advisor Model (SAM)

Build FOSSA Status

The SAM Open Source Project repository contains the source code, tools, and instructions to build a desktop version of the National Renewable Energy Laboratory's System Advisor Model (SAM). SAM is a simulation program for electricity generation projects. It has models for different kinds of renewable energy systems and financial models for residential, commercial, and utility-scale projects. For more details about SAM's capabilities, see the SAM website at https://sam.nrel.gov/.

For a short video describing the SAM repositories, see https://youtu.be/E5z1iiZfZ3M.

The SAM release notes are in https://github.com/NREL/SAM/blob/gh-pages/doc/releasenotes.html.

The desktop version of SAM for Windows, Mac, or Linux builds from the following open source projects:

  • SSC is a set of "compute modules" that simulate different kinds of power systems and financial structures. It can be run directly using the SAM Software Development Kit. This is the source code for SAM's models, and is the repository to use for researching the algorithms underlying the models.

  • LK is a scripting language that is integrated into SAM. SAM's user interface uses LK to calculate values to display on input pages. The user interface includes a script editor that allows users to write their own scripts from the user interface.

  • wxWidgets is a cross-platform graphical user interface platform used for SAM's user interface, and for the development tools included with SSC (SDKtool) and LK (LKscript). The current version of SAM uses wxWidgets 3.1.5.

  • WEX is a set of extensions to wxWidgets for custom user-interface elements developed specifically for SAM, LK script, and DView.

  • Google Test is a C++ test framework that enables comprehensive unit-testing of software. Contributions to the project will eventually be required to have associated unit tests written in this framework.

  • jsoncpp is a C++ library that allows manipulating JSON values, including serialization and deserialization to and from strings.

  • Python/Miniconda is for integration of Python scripts with the SAM user interface.

This repository, SAM, contains the code for SAM's user interface that assigns values to inputs of the SSC compute modules, runs the modules in the correct order, and displays simulation results. It also includes tools for editing LK scripts, viewing time series results, and generating shade data from a 3-dimensional representation of a photovoltaic array or solar hot water collector and nearby shading objects.

The SAM repository also includes two libraries from Sandia National Laboratories, stepwise, and LHS, which are distributed as part of the Dakota platform, licensed under LGPL.

Quick Steps for Building SAM

For detailed build instructions see the wiki with specific instructions for:

These are the general quick steps you need to follow to set up your computer for developing SAM:

  1. Set up your development tools:

  2. Download the wxWidgets 3.1.5 source code for your operating system from https://www.wxwidgets.org/downloads/.

  3. Build wxWidgets.

  4. In Windows, create the WXMSW3 environment variable on your computer to point to the wxWidgets installation folder, or in MacOS and Linux, create the dynamic link /usr/<USERNAME>/local/bin/wx-config-3 to point to /path/to/wxWidgets/bin/wx-config.

  5. As you did for wxWidgets, for each of the following projects, clone (download) the repository, build the project, and then (Windows only) create an environment variable pointing to the project folder. Build the projects in the following order, and assign the environment variable for each project before you build the next one:

ProjectRepository URLWindows Environment Variable
LKhttps://github.com/NREL/lkLKDIR
WEXhttps://github.com/NREL/wexWEXDIR
SSChttps://github.com/NREL/sscSSCDIR
SAMhttps://github.com/NREL/SAMSAMNTDIR
Google Testhttps://github.com/google/googletestGTEST

Contributing

If you would like to report an issue with SAM or make a feature request, please let us know by adding a new issue on the issues page.

If you would like to submit code to fix an issue or add a feature, you can use GitHub to do so. Please see Contributing for instructions.

License

SAM's open source code is copyrighted by the Alliance for Sustainable Energy and licensed with BSD-3-Clause terms, found here.

The stepwise and LHS LGPL licensed libraries from Sandia National Laboratories are pre-compiled Fortran libraries that are included in the SAM repository as binaries in the Sandia folder. You can replace the binaries with different versions by compiling your own version and replacing the binary/executable viles in the Sandia folder.

Citing this package

System Advisor Model Version 2022.11.21 (2022). SAM source code. National Renewable Energy Laboratory. Golden, CO. Accessed November 28, 2022. https://github.com/NREL/SAM