Skip to content

Compute modules in SAM

Darice L Guittet edited this page Nov 8, 2021 · 6 revisions

Compute modules in SSC are a structure that contain complete functions calculating large sections of a model in SAM.

Please see SSC Compute Modules for background and instruction on how to create a new compute module in SSC.

After a new compute module is created and set up in SSC, getting the compute module to be accessible via the SAM GUI or PySAM requires further steps. In SAM, a compute module is run within a "Configuration", which are defined in the startup.lk script. The addconfig function creates a new configuration, the name of which is called the "config name" in this document.

Adding a new compute module to SAM

  1. Setup the configuration in the startup.lk script: UI pages. Setup the defaults.

  2. Add a Module description to builder_PySAM.cpp::module_doc

    The compute module name needs to be reformatted by removing "cmod", removing underscores and capitalizing each letter that followed an underscore: "cmod_xx_yy" becomes "XxYy". The description should provide a high level way of distinguishing this compute module.

  3. Identify the config name with the compute module in data_structures.h::config_to_cmod_name

    The first entry is the config name, and the second entry is the reformatted compute module name from step one (e.g. XxYy).

  4. Build sam_api with export_config. First refresh the CMake build if this is not automated. The export_config project needs to be run first, and will generate the SAM_api and PySAM files for the new configuration. You will notice new files in the sam/api/include, sam/api/modules and if you have provided Default files for the configuration, sam/api/api_autogen/library/defaults. There will also be new files in pysam/docs, pysam/modules, and pysam/stubs.

  5. Update table in PySAM's docs/Models.rst to add the new compute module into table of contents of models.

  6. Update table in PySAM's docs/Configs.rst to describe the new SAM Configuration. For each configuration's financial model pairing, create a new row with the configuration type, a description, and a link to the documentation pages of the compute modules that comprise it.

  7. Add an Example or a Test to PySAM