Skip to main content

Python-based framework for multi-objective optimization of renewable energy systems using NREL's System Advisor Model (SAM)

Project description

sammoo

SAMMOO: System Advisor Model Multi-Objective Optimization

Python-based Framework for Multi-Objective Optimization of Renewable Energy Systems using NREL's System Advisor Model (SAM)

Optimization of Solar Industrial Process Heat (SIPH) systems using Concentrated Solar Power (CSP) technologies through the NREL PySAM package (System Advisor Model). This project was developed in the context of my Master's Thesis in Research in Industrial Technologies at the Universidad Nacional de Educaciรณn a Distancia (UNED), Spain.

sammoo logo


๐ŸŒž Overview

This Python package integrates:

  • System Advisor Model (SAM) via NREL PySAM for the simulation of parabolic trough systems.
  • ParMOO for multi-objective optimization using surrogate models.

It allows you to:

  • Run parametric studies on industrial CSP systems.
  • Optimize system configurations with multiple economic and technical objectives.
  • Analyze Pareto fronts and export results.

Pareto Front

๐Ÿ“ฆ Features

  • Modular simulation wrapper (ConfigSelection) for different SAM configurations.
  • Integration with PySAM modules: TroughPhysicalIph, LcoefcrDesign, CashloanHeat, etc.
  • Multi-objective optimization engine (ParMOOSim) using ParMOO.
  • Automatic switching from sequential to batch acquisition.
  • Exportable plots and CSV reports.

Thermal Load Profiles

๐Ÿ”ฅ ThermalLoadProfileLPG

The ThermalLoadProfileLPG class generates a realistic hourly thermal load profile from monthly LPG consumption (in tonnes), compatible with SAMโ€™s โ€œUser-defined thermal load profileโ€ input.

  • Working schedule: Monday to Friday, 6:00โ€“19:00
  • Outputs hourly thermal demand in kJ/h, kWh, and kW
  • Includes:
    • Yearly and weekly plotting
    • CSV export
    • Energy balance summary

Example usage:

from sammoo.profiles.thermal_load_lpg import ThermalLoadProfileLPG

monthly_data = {1: 5000, 2: 4000, ..., 12: 3000}
profile = ThermalLoadProfileLPG(monthly_data)
profile.plot_year()
profile.export_csv("thermal_profile.csv")

๐Ÿ—‚๏ธ Project Structure

sammoo/
โ”œโ”€โ”€ sammoo/                             # Core package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ version.py
โ”‚   โ”œโ”€โ”€ config_selection.py              # ConfigSelection class
โ”‚   โ”œโ”€โ”€ parmoo_simulation.py             # ParMOOSim class
โ”‚   โ”œโ”€โ”€ components/                      # New components module (v0.2.0)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ thermal_load_lpg.py          # ThermalLoadProfileLPG class (enhanced)
โ”‚   โ”‚   โ”œโ”€โ”€ weather_design_point.py      # Weather-based DNI calculation helper
โ”‚   โ”‚   โ””โ”€โ”€ solar_loop_configuration.py  # Solar field / loop setup helpers
โ”‚   โ”œโ”€โ”€ resources/
โ”‚   โ”‚   โ”œโ”€โ”€ solar_resource/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ seville_spain.csv        # Default weather CSV
โ”‚   โ”‚   โ””โ”€โ”€ collector_data/
โ”‚   โ”‚       โ””โ”€โ”€ iph_collectors_parameters.csv  # Industrial Process Heat collectors database
โ”‚   โ””โ”€โ”€ templates/                       # JSON SAM templates
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ””โ”€โ”€ iph_parabolic_commercial_owner/
โ”‚           โ”œโ”€โ”€ __init__.py
โ”‚           โ””โ”€โ”€ *.json
โ”œโ”€โ”€ examples/                            # Example usage scripts
โ”‚   โ”œโ”€โ”€ op1_single_objective_comparison.py
โ”‚   โ”œโ”€โ”€ opt2_design_point_multiobj.py
โ”‚   โ”œโ”€โ”€ opt3_multiobj_row_distance.py
โ”‚   โ””โ”€โ”€ opt4_startup_shutdown.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ MANIFEST.in
โ”œโ”€โ”€ LICENSE

๐Ÿ“‚ Example Scripts

The examples/ folder contains several usage scenarios of the sammoo package:

  • opt1_single_objective_comparison.py: Compare optimal designs for different single-objective formulations (e.g., LCOE, Payback, LCS, NPV).
  • opt2_design_point_multiobj.py: Multi-objective optimization at a fixed design point (e.g., SM and storage hours), optionally applying a thermal load profile.
  • opt3_multiobj_row_distance.py: Multi-objective optimization of solar field row spacing (Row_Distance) using ParMOO.
  • opt4_startup_shutdown.py: Optimization focusing on startup/shutdown temperatures and their impact on techno-economic performance.

๐Ÿ’ก Note: Example scripts (examples/) are not included in the PyPI installation.
If you want to explore the examples, please clone the GitHub repository.


๐Ÿš€ Quick Start

โœ… Option 1: Install from PyPI (recommended for users)

pip install sammoo

You can now use the package in Python:

from sammoo import ConfigSelection, ParMOOSim

๐Ÿ’ก Note: Example scripts (examples/) are not included in the PyPI installation.
If you want to explore examples, clone the GitHub repository instead:

git clone https://github.com/ppadillaq/sammoo.git
cd sammoo
python examples/single_objective_comparison.py

๐Ÿ›  Option 2: Install from source (for development)

If you want to work with the source code:

git clone https://github.com/ppadillaq/sammoo.git
cd sammoo
pip install -e .

โ–ถ๏ธ Run an example

python examples/opt1_single_objective_comparison.py

๐Ÿ›  Dependencies

  • Python โ‰ฅ 3.10
  • NREL PySAM
  • ParMOO
  • NumPy
  • Matplotlib (for plotting)

Install them via:

pip install pysam parmoo numpy matplotlib

๐Ÿ“ˆ Example Use Case

# Minimal example: multi-objective optimization with a thermal load profile

from sammoo import ConfigSelection, ParMOOSim
from sammoo.components import ThermalLoadProfileLPG

# 1) (Optional) Generate an hourly thermal load profile from monthly LPG consumption (kg)
monthly_kg = {1: 11000, 2: 9000, 3: 8000, 4: 9500, 5: 9200, 6: 9800,
              7: 8600, 8: 8700, 9: 9000, 10: 9400, 11: 8800, 12: 9600}
profile = ThermalLoadProfileLPG(monthly_kg=monthly_kg)  # uses default efficiency and PCI

# 2) Define the design space (use "continuous" / "integer")
design_vars = {
    "specified_solar_multiple": ([1.0, 3.0], "continuous"),
    "tshours": ([2, 8], "integer"),
}

# 3) Define objectives (minimize LCOE, maximize LCS)
selected_outputs = ["LCOE", "-LCS"]

# 4) Create the SAM configuration (optionally set collector/HTF)
cfg = ConfigSelection(
    config="Commercial owner",
    selected_outputs=selected_outputs,
    design_variables=design_vars,
    collector_name="Power Trough 250",   # optional
    htf_name="Therminol VP-1",           # optional
    verbose=0
)

# Apply the demand profile โ†’ sets timestep_load_abs and sizes q_pb_design
profile.apply_to_config(cfg)

# 5) Run the optimization (increase search_budget and sim_max for better results)
opt = ParMOOSim(cfg, search_budget=20, auto_switch=True)
opt.solve_all(sim_max=50)

# 6) Display results
print(opt.get_results())

โ˜€๏ธ Weather Data

The simulation requires a weather file (file_name) in CSV format. You can:

  • โœ… Provide your own via user_weather_file="path/to/weather.csv"
  • ๐Ÿ” Or let the framework use a built-in default (Tucson, AZ)

Your custom weather files must follow the TMY3 format used by SAM.

๐Ÿ“š Publications

Version 0.3.0 of this project was used in the development of the following master's thesis in the Master's programme in Research in Industrial Technologies (Energy Engineering track), UNED (Spain):

  • Padilla-Quesada, P. (2025). Sammoo: Un marco de optimizaciรณn multiobjetivo basada en simulaciones para el diseรฑo de sistemas solares tรฉrmicos de calor de proceso industrial [Trabajo Fin de Mรกster, Universidad Nacional de Educaciรณn a Distancia (UNED)]. https://hdl.handle.net/20.500.14468/31636

Download full thesis (PDF)

Future versions may include broader support for other CSP technologies, reinforcement learning-based controllers, and integration with digital twin platforms.

๐Ÿ“„ License

This project is licensed under the BSD 3-Clause License.
See the LICENSE file for full text.

๐Ÿ‘ค Author

Pedro Padilla Quesada
MSc in Research in Industrial Technologies
UNED, Spain

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sammoo-0.3.0.tar.gz (283.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sammoo-0.3.0-py3-none-any.whl (293.5 kB view details)

Uploaded Python 3

File details

Details for the file sammoo-0.3.0.tar.gz.

File metadata

  • Download URL: sammoo-0.3.0.tar.gz
  • Upload date:
  • Size: 283.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for sammoo-0.3.0.tar.gz
Algorithm Hash digest
SHA256 dc19c3510daa5cfb6701e6a42f1bd821a5838111c9a302147b6eb8b35747cb4d
MD5 b4fe13519b447690ef9a3b92bd2356c1
BLAKE2b-256 3434ce384da7134d3a6c4c766549293b794e7f541dc3b594972ea83aed3d9b80

See more details on using hashes here.

File details

Details for the file sammoo-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sammoo-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 293.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for sammoo-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5b884938159f9246457018fa92fe474e23c320d278dd786e897992bcfa1e7e8
MD5 e1fc4a36c84d8585ca3ca3e80141d327
BLAKE2b-256 fdb4d7b6b6d0f02af46891925f42161a6a85fb3671accafaa2ea18a35661ac72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page