Hello!
My team and I are using the PySAM and PySSC libraries to request WIND Toolkit Data inputs and run a simulation to return hourly energy and capacity factors for several coordinate pairs iteratively. Our WIND Toolkit Data input (.srw file) is in hourly time series. However, we run into the issue that we cannot retrieve these hourly parameters other than their annual averages.
Our goal is to retrieve the hourly system power generated (kw) for each hour since Jan 1 within a pandas dataframe. Are there example Python scripts/notebooks of how we could retrieve an this hourly system power generated (kw) and capacity factor with PySam using PySSC?
For some additional context here are some snippets of our code of creating the ssc objects and retrieving the average annual data.
import PySAM
from PySAM.PySSC import PySSC
ssc = PySSC()
lat_in = a provided latitude
lon_in = a provided longitude
## =====> ADDED TO READ DATA FROM Windtoolkit
# Resource inputs for SAM model: ## need to add b
wfd = ssc.data_create()
ssc.data_set_number(wfd, b'lat', lat_in)
ssc.data_set_number(wfd, b'lon', lon_in)
# Create SAM compliant object
data = ssc.data_create()
ssc.data_set_table(data, b'wind_resource_data', wfd)
ssc.data_free(wfd)
- Code from the SAM Code Generator -
# leaving this code out of this question to reduce code length
module = ssc.module_create(b'windpower')
ssc.module_exec_set_print( 0 );
if ssc.module_exec(module, data) == 0:
print ('windpower simulation error')
idx = 1
msg = ssc.module_log(module, 0)
while (msg != None):
print (' : ' + msg.decode("utf - 8"))
msg = ssc.module_log(module, idx)
idx = idx + 1
SystemExit( "Simulation Error" );
ssc.module_free(module)
module = ssc.module_create(b'grid')
ssc.module_exec_set_print( 0 );
if ssc.module_exec(module, data) == 0:
print ('grid simulation error')
idx = 1
msg = ssc.module_log(module, 0)
while (msg != None):
print (' : ' + msg.decode("utf - 8"))
msg = ssc.module_log(module, idx)
idx = idx + 1
SystemExit( "Simulation Error" );
ssc.module_free(module)
annual_energy = ssc.data_get_number(data, b'annual_energy');
print ('Annual AC energy in Year 1 = ', annual_energy)
capacity_factor = ssc.data_get_number(data, b'capacity_factor');
print ('Capacity factor in Year 1 = ', capacity_factor)
ssc.data_free(data);