import pvlib
import pandas as pd
import matplotlib.pyplot as plt
#Salt Lake City coordinates and weather data
coordinates = [
(40.7608, -111.8910, 'Salt Lake City', 1319, 'Etc/GMT-7')
]
sandia_modules = pvlib.pvsystem.retrieve_sam('SandiaMod')
sapm_inverters = pvlib.pvsystem.retrieve_sam('cecinverter')
module = sandia_modules['Canadian_Solar_CS5P_220M___2009_']
modules_per_string = 21
strings_per_inverter = 250
inverter = sapm_inverters['Sungrow_Power_Supply_Co___Ltd___SC1000KU__540V_']
temperature_model_parameters = pvlib.temperature.TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
tmys = []
for location in coordinates:
latitude, longitude, name, altitude, timezone = location
weather = pvlib.iotools.get_pvgis_tmy(latitude, longitude)[0]
weather.index.name = "utc_time"
tmys.append(weather)
from pvlib.pvsystem import PVSystem, Array, FixedMount
from pvlib.location import Location
from pvlib.modelchain import ModelChain
energies = {}
for location, weather in zip(coordinates, tmys):
latitude, longitude, name, altitude, timezone = location
location = Location(
latitude,
longitude,
name=name,
altitude=altitude,
tz=timezone,
)
mount = FixedMount(surface_tilt=latitude, surface_azimuth=180)
array = Array(
mount=mount,
module_parameters=module,
temperature_model_parameters=temperature_model_parameters,
modules_per_string=modules_per_string,
strings=strings_per_inverter
)
system = PVSystem(arrays=[array], inverter_parameters=inverter)
mc = ModelChain(system, location)
mc.run_model(weather)
annual_energy = mc.results.ac.sum() #AC power series
energies[name] = annual_energy
energies = pd.Series(energies)/1000
print(energies)
print(mc.results.ac)
plt.plot(range(0,8760,1), mc.results.ac)
plt.xlabel('Hour of year')
plt.ylabel('Power (W)')
Salt Lake City 1.973942e+06 dtype: float64 utc_time 2012-01-01 00:00:00+00:00 -3.003918e+02 2012-01-01 01:00:00+00:00 -3.003918e+02 2012-01-01 02:00:00+00:00 -3.003918e+02 2012-01-01 03:00:00+00:00 -3.003918e+02 2012-01-01 04:00:00+00:00 -3.003918e+02 ... 2005-12-31 19:00:00+00:00 1.001306e+06 2005-12-31 20:00:00+00:00 1.001306e+06 2005-12-31 21:00:00+00:00 6.466355e+05 2005-12-31 22:00:00+00:00 5.047714e+05 2005-12-31 23:00:00+00:00 1.675182e+05 Length: 8760, dtype: float64
Text(0, 0.5, 'Power (W)')
Front of meter, single entity selling generated power at agreed upon Power Purchase Agreement (PPA) price
Includes project Capex, Opex, Revenue (PPA), Debt, Incentives (Investment Tax Credit), and Depreciation
Setup inputs in desktop tool, export PySAM JSON's, iterate in PySAM
import json
import PySAM.Singleowner as so # import the Single Owner module from PySAM
import PySAM.Cashloan as co #Residential/Commercial BTM financial, covered in next section
# create a new instance of the Singleowner module
so_model = so.new()
#Setup model in SAM, export JSON files with inputs
#For more information on PySAM input json's, see https://nrel-pysam.readthedocs.io/en/main/getting-started.html
#Alternatively, start with default inputs to financial model (may not be accurate for your case)
so_model = so.default("FlatPlatePVSingleOwner")
# get the inputs from the JSON file
with open( 'Tutorial_E_data/SO_example_singleowner.json', 'r') as f:
so_inputs = json.load( f )
# iterate through the input key-value pairs and set the module inputs
for k, v in so_inputs.items():
if k != 'number_inputs':
so_model.value(k, v)
so_model.export() #View inputs
{'Revenue': {'dispatch_factors_ts': (0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1, 0.8, 0.8, 0.8, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.8, 0.8, 1.1, 1.1, 1.1, 1.1, 1.1, 1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1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)), 'dispatch_tod_factors': (1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), 'flip_target_percent': 11.0, 'flip_target_year': 20.0, 'ppa_escalation': 1.0, 'ppa_multiplier_model': 0.0, 'ppa_price_input': (0.043,), 'ppa_soln_mode': 1.0}, 'FinancialParameters': {'analysis_period': 25.0, 'construction_financing_cost': 35244.49152156341, 'cost_debt_closing': 0.0, 'cost_debt_fee': 2.75, 'cost_other_financing': 0.0, 'debt_option': 1.0, 'debt_percent': 60.0, 'dscr': 1.3, 'dscr_limit_debt_fraction': 0.0, 'dscr_maximum_debt_fraction': 100.0, 'dscr_reserve_months': 6.0, 'equip1_reserve_cost': 0.1, 'equip1_reserve_freq': 15.0, 'equip2_reserve_cost': 0.0, 'equip2_reserve_freq': 15.0, 'equip3_reserve_cost': 0.0, 'equip3_reserve_freq': 3.0, 'equip_reserve_depr_fed': 0.0, 'equip_reserve_depr_sta': 0.0, 'federal_tax_rate': (21.0,), 'inflation_rate': 2.5, 'insurance_rate': 0.0, 'loan_moratorium': 0.0, 'months_receivables_reserve': 0.0, 'months_working_reserve': 6.0, 'payment_option': 0.0, 'prop_tax_assessed_decline': 0.0, 'prop_tax_cost_assessed_percent': 100.0, 'property_tax_rate': 0.0, 'real_discount_rate': 6.4, 'reserves_interest': 1.75, 'salvage_percentage': 0.0, 'state_tax_rate': (7.0,), 'system_capacity': 100003.0, 'term_int_rate': 7.0, 'term_tenor': 18.0}, 'SystemCosts': {'om_capacity': (15.0,), 'om_capacity_escal': 0.0, 'om_fixed': (0.0,), 'om_fixed_escal': 0.0, 'om_production': (0.0,), 'om_production_escal': 0.0, 'total_installed_cost': 1342647.2960595584}, 'LandLease': {'land_area': 7.355702940057229, 'om_land_lease': (0.0,), 'om_land_lease_escal': 0.0}, 'TaxCreditIncentives': {'itc_fed_amount': (0.0,), 'itc_fed_amount_deprbas_fed': 1.0, 'itc_fed_amount_deprbas_sta': 1.0, 'itc_fed_percent': (0.0,), 'itc_fed_percent_deprbas_fed': 1.0, 'itc_fed_percent_deprbas_sta': 1.0, 'itc_fed_percent_maxvalue': (1e+38,), 'itc_sta_amount': (0.0,), 'itc_sta_amount_deprbas_fed': 0.0, 'itc_sta_amount_deprbas_sta': 0.0, 'itc_sta_percent': (0.0,), 'itc_sta_percent_deprbas_fed': 0.0, 'itc_sta_percent_deprbas_sta': 0.0, 'itc_sta_percent_maxvalue': (1e+38,), 'ptc_fed_amount': (0.0275,), 'ptc_fed_escal': 2.5, 'ptc_fed_term': 10.0, 'ptc_sta_amount': (0.0,), 'ptc_sta_escal': 0.0, 'ptc_sta_term': 10.0}, 'Depreciation': {'depr_alloc_custom_percent': 0.0, 'depr_alloc_macrs_15_percent': 1.5, 'depr_alloc_macrs_5_percent': 90.0, 'depr_alloc_sl_15_percent': 2.5, 'depr_alloc_sl_20_percent': 3.0, 'depr_alloc_sl_39_percent': 0.0, 'depr_alloc_sl_5_percent': 0.0, 'depr_bonus_fed': 0.0, 'depr_bonus_fed_custom': 0.0, 'depr_bonus_fed_macrs_15': 1.0, 'depr_bonus_fed_macrs_5': 1.0, 'depr_bonus_fed_sl_15': 0.0, 'depr_bonus_fed_sl_20': 0.0, 'depr_bonus_fed_sl_39': 0.0, 'depr_bonus_fed_sl_5': 0.0, 'depr_bonus_sta': 0.0, 'depr_bonus_sta_custom': 0.0, 'depr_bonus_sta_macrs_15': 1.0, 'depr_bonus_sta_macrs_5': 1.0, 'depr_bonus_sta_sl_15': 0.0, 'depr_bonus_sta_sl_20': 0.0, 'depr_bonus_sta_sl_39': 0.0, 'depr_bonus_sta_sl_5': 0.0, 'depr_custom_schedule': (0.0,), 'depr_fedbas_method': 1.0, 'depr_itc_fed_custom': 0.0, 'depr_itc_fed_macrs_15': 0.0, 'depr_itc_fed_macrs_5': 1.0, 'depr_itc_fed_sl_15': 0.0, 'depr_itc_fed_sl_20': 0.0, 'depr_itc_fed_sl_39': 0.0, 'depr_itc_fed_sl_5': 0.0, 'depr_itc_sta_custom': 0.0, 'depr_itc_sta_macrs_15': 0.0, 'depr_itc_sta_macrs_5': 1.0, 'depr_itc_sta_sl_15': 0.0, 'depr_itc_sta_sl_20': 0.0, 'depr_itc_sta_sl_39': 0.0, 'depr_itc_sta_sl_5': 0.0, 'depr_stabas_method': 1.0}, 'PaymentIncentives': {'cbi_fed_amount': 0.0, 'cbi_fed_deprbas_fed': 0.0, 'cbi_fed_deprbas_sta': 0.0, 'cbi_fed_maxvalue': 1e+38, 'cbi_fed_tax_fed': 1.0, 'cbi_fed_tax_sta': 1.0, 'cbi_oth_amount': 0.0, 'cbi_oth_deprbas_fed': 0.0, 'cbi_oth_deprbas_sta': 0.0, 'cbi_oth_maxvalue': 1e+38, 'cbi_oth_tax_fed': 1.0, 'cbi_oth_tax_sta': 1.0, 'cbi_sta_amount': 0.0, 'cbi_sta_deprbas_fed': 0.0, 'cbi_sta_deprbas_sta': 0.0, 'cbi_sta_maxvalue': 1e+38, 'cbi_sta_tax_fed': 1.0, 'cbi_sta_tax_sta': 1.0, 'cbi_uti_amount': 0.0, 'cbi_uti_deprbas_fed': 0.0, 'cbi_uti_deprbas_sta': 0.0, 'cbi_uti_maxvalue': 1e+38, 'cbi_uti_tax_fed': 1.0, 'cbi_uti_tax_sta': 1.0, 'ibi_fed_amount': 0.0, 'ibi_fed_amount_deprbas_fed': 0.0, 'ibi_fed_amount_deprbas_sta': 0.0, 'ibi_fed_amount_tax_fed': 1.0, 'ibi_fed_amount_tax_sta': 1.0, 'ibi_fed_percent': 0.0, 'ibi_fed_percent_deprbas_fed': 0.0, 'ibi_fed_percent_deprbas_sta': 0.0, 'ibi_fed_percent_maxvalue': 1e+38, 'ibi_fed_percent_tax_fed': 1.0, 'ibi_fed_percent_tax_sta': 1.0, 'ibi_oth_amount': 0.0, 'ibi_oth_amount_deprbas_fed': 0.0, 'ibi_oth_amount_deprbas_sta': 0.0, 'ibi_oth_amount_tax_fed': 1.0, 'ibi_oth_amount_tax_sta': 1.0, 'ibi_oth_percent': 0.0, 'ibi_oth_percent_deprbas_fed': 0.0, 'ibi_oth_percent_deprbas_sta': 0.0, 'ibi_oth_percent_maxvalue': 1e+38, 'ibi_oth_percent_tax_fed': 1.0, 'ibi_oth_percent_tax_sta': 1.0, 'ibi_sta_amount': 0.0, 'ibi_sta_amount_deprbas_fed': 0.0, 'ibi_sta_amount_deprbas_sta': 0.0, 'ibi_sta_amount_tax_fed': 1.0, 'ibi_sta_amount_tax_sta': 1.0, 'ibi_sta_percent': 0.0, 'ibi_sta_percent_deprbas_fed': 0.0, 'ibi_sta_percent_deprbas_sta': 0.0, 'ibi_sta_percent_maxvalue': 1e+38, 'ibi_sta_percent_tax_fed': 1.0, 'ibi_sta_percent_tax_sta': 1.0, 'ibi_uti_amount': 0.0, 'ibi_uti_amount_deprbas_fed': 0.0, 'ibi_uti_amount_deprbas_sta': 0.0, 'ibi_uti_amount_tax_fed': 1.0, 'ibi_uti_amount_tax_sta': 1.0, 'ibi_uti_percent': 0.0, 'ibi_uti_percent_deprbas_fed': 0.0, 'ibi_uti_percent_deprbas_sta': 0.0, 'ibi_uti_percent_maxvalue': 1e+38, 'ibi_uti_percent_tax_fed': 1.0, 'ibi_uti_percent_tax_sta': 1.0, 'pbi_fed_amount': (0.0,), 'pbi_fed_escal': 0.0, 'pbi_fed_for_ds': 0.0, 'pbi_fed_tax_fed': 1.0, 'pbi_fed_tax_sta': 1.0, 'pbi_fed_term': 10.0, 'pbi_oth_amount': (0.0,), 'pbi_oth_escal': 0.0, 'pbi_oth_for_ds': 0.0, 'pbi_oth_tax_fed': 1.0, 'pbi_oth_tax_sta': 1.0, 'pbi_oth_term': 10.0, 'pbi_sta_amount': (0.0,), 'pbi_sta_escal': 0.0, 'pbi_sta_for_ds': 0.0, 'pbi_sta_tax_fed': 1.0, 'pbi_sta_tax_sta': 1.0, 'pbi_sta_term': 10.0, 'pbi_uti_amount': (0.0,), 'pbi_uti_escal': 0.0, 'pbi_uti_for_ds': 0.0, 'pbi_uti_tax_fed': 1.0, 'pbi_uti_tax_sta': 1.0, 'pbi_uti_term': 10.0}, 'BatterySystem': {'en_batt': 0.0, 'en_wave_batt': 0.0}, 'ElectricityRates': {'en_electricity_rates': 0.0, 'rate_escalation': (0.0,)}, 'SystemOutput': {'degradation': (0.0,), 'gen': (0.0,), 'system_capacity': 100003.0}, 'UtilityBill': {}, 'Lifetime': {'system_use_lifetime_output': 1.0}, 'FuelCell': {}, 'CapacityPayments': {'cp_battery_nameplate': 0.0, 'cp_capacity_credit_percent': (0.0,), 'cp_capacity_payment_amount': (0.0,), 'cp_capacity_payment_esc': 0.0, 'cp_capacity_payment_type': 0.0, 'cp_system_nameplate': 1.1535315638278083}, 'GridLimits': {'grid_curtailment_price': (0.0,), 'grid_curtailment_price_esc': 0.0}, 'LCOS': {'batt_salvage_percentage': 0.0}, 'ChargesByMonth': {}, 'HybridFin': {}, 'Monthly': {}, 'Outputs': {'flip_target_year': 20.0, 'ppa_escalation': 1.0}}
so_model.SystemOutput.gen = mc.results.ac / 1000 #kWAC
so_model.Lifetime.system_use_lifetime_output = 0
so_model.SystemOutput.degradation = [0.5] #%/yr
so_model.FinancialParameters.system_capacity = 1153.53 #DC capacity, needed for O&M scaling
#Modify cost values
so_model.SystemCosts.total_installed_cost = 1350000 #$ (Capex)
#Capacity based OM - can be single value or annual schedule, enter as an array of size 1 for fixed input
so_model.SystemCosts.om_capacity = [15] #$/kW/yr (Opex)
print(so_model.SystemCosts.om_fixed) #Show that fixed O&M costs are $0, only capacity based OM in this example
(0.0,)
#Modify revenue, PPA
so_model.Revenue.ppa_soln_mode = 1 #Specify PPA Price
#PPA price can be single value, annual schedule
#Can also add an escalation rate, inflation does not apply
so_model.Revenue.ppa_price_input = [0.055] #5.5 cents/kWh
#Alternate - Specify IRR target
#so_model.Revenue.ppa_soln_mode = 0 #Specify IRR target
# so_model.Revenue.flip_target_percent = 11 #%
# so_model.Revenue.flip_target_year = 20
# so_model.Revenue.ppa_escalation = 1 #%/yr
so_model.FinancialParameters.inflation_rate = 2.5 #%/yr
so_model.FinancialParameters.term_int_rate = 7 #%, annual interest rate
so_model.FinancialParameters.analysis_period = 25 #yrs, analysis period
so_model.FinancialParameters.construction_financing_cost = 35244.49 #$, total construction financing cost
so_model.FinancialParameters.real_discount_rate = 6.4 #%/yr
#Construction financing cost linked to total installed cost, any changes to total installed cost should include updates to any construction financing costs
#Set investment tax credit
so_model.TaxCreditIncentives.itc_fed_percent = [0] #%
so_model.TaxCreditIncentives.ptc_fed_amount = [0.0275] #$/kWh
so_model.TaxCreditIncentives.ptc_fed_term = 10 #years
so_model.TaxCreditIncentives.ptc_fed_escal = 2.5 #%/yr
so_model.PaymentIncentives.ibi_fed_amount = 0 #$ Federal investment based incentives
so_model.execute() #Run model
print("Net Present Value: ", so_model.Outputs.project_return_aftertax_npv)
print("Internal Rate of Return: ", so_model.Outputs.flip_actual_irr)
print("Levelized cost of energy (nominal): ", so_model.Outputs.lcoe_real, " cents/kWh")
plt.bar(range(0,int(so_model.FinancialParameters.analysis_period+1),1),so_model.Outputs.cf_project_return_aftertax)
plt.xlabel('Year')
plt.ylabel('Dollars ($)')
plt.title('Project After-tax Cash Flow')
Net Present Value: -20558.617404061835 Internal Rate of Return: 7.176400789734087 Levelized cost of energy (nominal): 4.83350644904887 cents/kWh
Text(0.5, 1.0, 'Project After-tax Cash Flow')