-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathsimple_lcoe_calculator.py
More file actions
65 lines (51 loc) · 1.88 KB
/
simple_lcoe_calculator.py
File metadata and controls
65 lines (51 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
LCOE Calculation
================
Example of an LCOE calculation using an approach implemented in NREL's "Simple
LCOE Calculator", accessible at http://www.nrel.gov/analysis/tech-lcoe.html
"""
# %%
# This example shows basic usage of pvlib's lcoe calculation with
# :py:meth:`pvlib.financial.lcoe` and :py:meth:`pvlib.financial.crf`.
# The example shown here will generate a Series of annual cost and production
# data, and a numerical LCOE. To be comparable with NREL's implemenation,
# this example adheres to the following assumptions: that energy production
# and O&M costs are constant and that the entire project is financed with a
# loan. Input values for CAPEX, capacity factor, and O&M were sourced from
# NREL's ATB for a residential system in 2022 located in Resource Class 5
# with moderate technological advancement. The discount rate is set to the
# value recommended in NREL's implementation.
import numpy as np
import pandas as pd
from pvlib import financial
# Analysis period
n = 20
# Capacity factor
cf = 0.15357857
# Constant annual energy production
energy = np.full(n, cf*8760)
# Real discount rate
discount_rate = 0.03
# Capital recovery factor
my_crf = financial.crf(discount_rate, n)
# CAPEX
capex = 2443.45
# Fraction of capital cost
loan_frac = 1
# Annual capital costs
cap_cost = np.array([capex*loan_frac*my_crf for i in range(n)])
# Constant annual O&M
fixed_om = pd.Series(data=[26.98 for j in range(n)])
# Put data in table and display
table = pd.DataFrame(columns=['Production [kWh/kW]', 'Capital cost [$/kW]',
'O&M [$/kW]'])
table['Production [kWh/kW]'] = energy
table['Capital cost [$/kW]'] = cap_cost
table['O&M [$/kW]'] = fixed_om
table.index.name = 'Year'
table
# %%
# Get LCOE
my_lcoe = financial.lcoe(production=energy, cap_cost=cap_cost,
fixed_om=fixed_om)
print('LCOE = ' + str(my_lcoe) + str(' cents/kWh'))