Hello,
I am running pvwatts8 using pySAM for multiple locations in my study area. I've run into an issue where the LCOE output does not reflect the output when running the same location and system size in the GUI of SAM. Below is the code I am using, picking just one location the weather file used is for 41.712 latitude and -72.358 longitude. The code below returns a LCOE of 74.42 cents per kWh where as the GUI of SAM returns 7.29 cents per kWh. The system nameplate kWdc capacity is 3338 with a grc of 0.37. Any help understanding this discrepancy is much appreciated.
Adam
Code:
import PySAM.Pvwattsv8 as pv
import PySAM.Singleowner as so
import PySAM.ResourceTools as tools
import csv
import pandas as pd
kW_filename = open('C:/Dissertation/Chapter_1_SolarSiting/Data/CT_Data/Parcel_Analysis/Results/Version_1/Test.csv', 'r')
file = csv.DictReader(kW_filename)
Kw_list = []
weather_files = []
acres = []
#Solar_ID = []
for col in file:
Kw_list.append(col)
weather_files.append(col)
acres.append(col)
#Solar_ID.append(col)
print('System Capacity (kW):', Kw_list)
print('weather file name:', weather_files)
print('Total parcel acres:', acres)
i = 0
capacity_factor_list = []
annual_energy_list = []
Example_PPA_list = []
Levelized_cost_list = []
lat_list = []
lon_list = []
for kW in Kw_list:
pvSingleOwner_model = pv.default("PVWattsSingleOwner")
financial_model = so.from_existing(pvSingleOwner_model, 'PVWattsSingleOwner')
pvSingleOwner_model.value("system_capacity", float(kW))
pvSingleOwner_model.value("gcr", 0.37)
pvSingleOwner_model.value("array_type", 0)
weather_path = "C:/Users/adam.gallaher/SAM Downloaded Weather Files/%s" % weather_files
weather_data = tools.SAM_CSV_to_solar_data(weather_path)
pvSingleOwner_model.SolarResource.solar_resource_data = weather_data
i = i + 1
pvSingleOwner_model.execute(0)
financial_model.execute(0)
capacity_factor = pvSingleOwner_model.Outputs.capacity_factor
capacity_factor_list.append(capacity_factor)
print(capacity_factor)
annual_energy = pvSingleOwner_model.Outputs.annual_energy
annual_energy_list.append(annual_energy)
print(annual_energy)
Example_PPA = financial_model.Outputs.ppa
Example_PPA_list.append(Example_PPA)
print(Example_PPA)
Levelized_cost = financial_model.Outputs.lcoe_real
Levelized_cost_list.append(Levelized_cost)
print(Levelized_cost)
lat = pvSingleOwner_model.Outputs.lat
lat_list.append(lat)
print(lat)
long = pvSingleOwner_model.Outputs.lon
lon_list.append(long)
print(long)
dictionary = {'Capacity Factor': capacity_factor_list, 'Annual Energy Output (kWh)': annual_energy_list, 'Example PPA (cents/kWh)': Example_PPA_list,
'LCOE (cents/kWh)': Levelized_cost_list, 'Latitude': lat_list, 'Longitude': lon_list, 'weather_files': weather_files, 'Acres': acres, 'kW': Kw_list,}
dataframe = pd.DataFrame(dictionary)
dataframe.to_csv('C:/Dissertation/Chapter_1_SolarSiting/Data/CT_Data/Parcel_Analysis/Results/Version_1/Test_Output.csv')