Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test_pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install nrel-pysam==$VER
conda install -c conda-forge ipopt

- uses: actions/checkout@v3
- name: Checkout SAM
Expand Down Expand Up @@ -142,6 +143,7 @@ jobs:
pip install -r requirements.txt
pip install -r tests/requirements.txt
pip install nrel-pysam==$VER
conda install -c conda-forge ipopt

- uses: actions/checkout@v3
- name: Checkout SAM
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ files/defaults/
.mypy_cache

*.zip
files/6parsolve_output
62 changes: 15 additions & 47 deletions docs/helper-tools.rst
Original file line number Diff line number Diff line change
@@ -1,54 +1,22 @@
Helper Functions (Tools)
=========================

These helper functions provide additional functionality for working with specific models.
PySAM includes several helper tools that provide additional functionality beyond the core simulation models.
These tools assist with data preparation, resource file handling, battery modeling, utility rate calculations, and photovoltaic module parameter fitting.

Resource Tools
---------------
The tools covered in this section include:

Access resource tools with ``import PySAM.ResourceTools``.
- **Resource Tools**: Download and format solar and wind resource data from national databases
- **Battery Tools**: Utilities for battery system modeling and analysis
- **Load Tools**: Manipulate and analyze electrical load profiles
- **Utility Rate Tools**: Convert utility rate data from URDB to SAM format
- **CEC Module Parameter Solver**: Fit six-parameter single-diode model to photovoltaic module test data

These functions help with solar resource, wind resource and utility rate data, downloads and formatting.
See how to download solar resource data from the National Solar Radiation Database or wind resource data from the WindToolKit.
Use resource files directly in your PySAM models or input them as dictionaries.
.. toctree::
:maxdepth: 1

Please see an example of FetchResource: `FetchResourceFileExample.py <https://github.com/NREL/pysam/blob/main/Examples/FetchResourceFileExample.py>`_

.. automodule:: files.ResourceTools
:members:
:undoc-members:

Battery Tools
---------------

Access battery tools with ``import PySAM.BatteryTools``.

.. automodule:: files.BatteryTools
:members:
:undoc-members:

Load Tools
---------------

Access load tools with ``import PySAM.LoadTools``.

These functions help manipulate load data for local analysis and the utility rate functions

Please see an example of get_monthly_peaks: `LoadToolsExample.py <https://github.com/NREL/pysam/blob/main/Examples/LoadToolsExample.py>`_

.. automodule:: files.LoadTools
:members:
:undoc-members:

Utility Rate Tools
------------------

Access utility rate tools with ``import PySAM.UtilityRateTools``.

These functions translate URDB data into the SAM format

Please see an example of URDBv8_to_ElectricityRates `here <https://github.com/NREL/pysam/blob/main/Examples/UtilityRatesExample.py>`_

.. automodule:: files.UtilityRateTools
:members:
:undoc-members:
tools/ResourceTools
tools/BatteryTools
tools/LoadTools
tools/UtilityRateTools
tools/SixParSolve
39 changes: 39 additions & 0 deletions docs/tools/BatteryTools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
BatteryTools
=============

Overview
--------

The BatteryTools module provides utilities for battery energy storage system modeling and analysis in PySAM. These tools help with battery sizing, dispatch strategy configuration, and performance analysis.

Key features:

- Battery sizing calculations
- Dispatch strategy helpers
- Battery lifetime and degradation analysis
- Utility functions for battery model configuration
- Integration with PySAM battery-enabled models (PVBattery, StandAloneBattery, etc.)

BatteryTools is included with PySAM. Import it with:

.. code-block:: python

import PySAM.BatteryTools as battery

Relevant Examples
------------------

1. **Battery Stateful Example**

https://github.com/NatLabRockies/pysam/blob/main/Examples/PySAMWorkshop.ipynb

2. **Battery Stateful with Custom Life Model Example**

https://github.com/NatLabRockies/pysam/blob/main/Examples/BatteryStateful_CustomLifeModel.ipynb

API Reference
-------------

.. automodule:: files.BatteryTools
:members:
:undoc-members:
35 changes: 35 additions & 0 deletions docs/tools/LoadTools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
LoadTools
==========

Overview
--------

The LoadTools module provides utilities for manipulating and analyzing electrical load profile data. These tools help prepare load data for PySAM simulations, particularly for utility rate analysis and demand charge calculations.

Key features:

- Load profile manipulation and scaling
- Peak demand identification (monthly, annual)
- Time-of-use period assignment
- Load profile generation and synthesis
- Integration with utility rate structures

LoadTools is included with PySAM. Import it with:

.. code-block:: python

import PySAM.LoadTools as load

Relevant Examples
------------------

1. **LoadTools Example**

https://github.com/NREL/pysam/blob/main/Examples/LoadToolsExample.py

API Reference
-------------

.. automodule:: files.LoadTools
:members:
:undoc-members:
76 changes: 76 additions & 0 deletions docs/tools/ResourceTools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
ResourceTools
==============

Overview
--------

The ResourceTools module provides utilities for downloading, formatting, and working with solar and wind resource data from national databases. These tools streamline the process of obtaining weather data needed for PySAM simulations.

Key features:

- Download solar resource data from the National Solar Radiation Database (NSRDB)
- Download wind resource data from the WIND Toolkit
- Format resource data for use in PySAM models
- Convert between resource file formats and Python dictionaries
- Fetch and parse utility rate data

ResourceTools is included with PySAM. Import it with:

.. code-block:: python

import PySAM.ResourceTools as tools

Data Sources
------------

National Solar Radiation Database (NSRDB)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The NSRDB provides solar and meteorological data for locations across the Americas. Data includes:

- Global Horizontal Irradiance (GHI)
- Direct Normal Irradiance (DNI)
- Diffuse Horizontal Irradiance (DHI)
- Temperature, wind speed, and other meteorological variables
- Temporal resolution: 30-minute or hourly
- Spatial resolution: 4 km

**Website:** https://nsrdb.nrel.gov/

WIND Toolkit
~~~~~~~~~~~~

The WIND Toolkit provides wind resource data for the continental United States. Data includes:

- Wind speed at multiple heights
- Wind direction
- Temperature and pressure
- Temporal resolution: 5-minute
- Spatial resolution: 2 km

**Website:** https://www.nrel.gov/grid/wind-toolkit.html

API Key
-------

To download resource data from NREL APIs, you need a free API key:

1. Sign up at https://developer.nrel.gov/signup/
2. You'll receive an API key via email
3. Use the key in the ``api_key`` parameter when fetching data

**Rate Limits:** The API allows 1,000 requests per hour per API key.

Relevant Examples
------------------

1. **FetchResourceFileExample.py**

https://github.com/NREL/pysam/blob/main/Examples/FetchResourceFileExample.py

API Reference
-------------

.. automodule:: files.ResourceTools
:members:
:undoc-members:
Loading
Loading