Solar performance calculator


License
MIT
Install
pip install swc==0.7.2

Documentation

SWC

SWC

Simplified solar performance simulator

MIT License GitHub last commit Version PyPI


Table of contents

About

I made this code for my personal use. The code merges the NSRDB-API and the SAM-SDK in one easy code to simulate the performance of a solar power plant at a given location. If you want to know more about the SAM-SDK or NSRDB-API please visit their respective websites.

Installations

To install using pip

pip install swc

To upgrade

pip install --upgrade swc

How to use

Using the solar radiation data as input, we implemented an easy way to change the configuration parameters to simulate the performance of a PV system.

Configuration

First you need to get an API. Read https://developer.nrel.gov/signup/. Once you have it, create a .env file under your working folder that includes:

API_KEY=YOUR API_KEY_GOES_HERE

And thats it!

Solar radiation data

To get solar radiation data from the NSRB from a Jupyter Notebook or Console

import swc.nsrdb as nsrdb

# Define site dictionary
site_info = {
    "lat": 18.3,
    "lng": -99.3,
    "api_key": "YourAPIKEY",
    "force_download": False,
    "year": "2014",
}

# Download data
df = nsrdb.get_nsrdb_data(**site_info)
print(df.head())

SAM simulation

To perform a SAM simulation using the data from the NSRDB

import swc.sam_simulation as sam

# Define simulation params
simulation_params = {
    "lat": site_info["lat"],
    "lng": site_info["lng"],
    "losses": 4.3,
    "dc_ac_ratio": 1.2,
    "inv_eff": 96.0,
    "tilt": 20,
    "system_capacity": 100,
    "elevation": 1100,
    "timezone": -6,
    "configuration": 0,  #  0 For fixed tilt, 2 for 1-axis and 4 for 2-axis
    "gcr": 0.4,
    "azimuth": 100,
    "interval": 60,
}

# Run SAM simulation
output_data, output_params = sam.sam_simulation(df, **simulation_params)

print(output_data.head())

Authors

  • pesap
  • Sergio Castellanos

Todo

  • Update the code to include more use cases.