Skip to content

Commit 8354226

Browse files
committed
add annual inflation rate
1 parent 39d84ae commit 8354226

9 files changed

+4342
-4311
lines changed

Snakefile

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ configfile: "config.yaml"
44

55
rule compile_cost_assumptions:
66
input:
7+
inflation_rate = "inputs/prc_hicp_aind_page_spreadsheet.xlsx",
78
pypsa_costs = "inputs/costs_PyPSA.csv",
89
fraunhofer_costs = "inputs/Fraunhofer_ISE_costs.csv",
910
fraunhofer_energy_prices = "inputs/Fraunhofer_ISE_energy_prices.csv",

outputs/costs_2020.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2025.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2030.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2035.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2040.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2045.csv

+615-615
Large diffs are not rendered by default.

outputs/costs_2050.csv

+615-615
Large diffs are not rendered by default.

scripts/compile_cost_assumptions.py

+36-6
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ def get_data_from_DEA(data_in, expectation=None):
646646

647647
return d_by_tech
648648

649-
def adjust_for_inflation(costs, techs, ref_year, col):
649+
def adjust_for_inflation(inflation_rate, costs, techs, ref_year, col):
650650
"""
651651
adjust the investment costs for the specified techs for inflation.
652652
@@ -657,12 +657,25 @@ def adjust_for_inflation(costs, techs, ref_year, col):
657657
costs: pd.Dataframe
658658
Dataframe containing the costs data with multiindex on technology and one index key 'investment'.
659659
"""
660+
661+
def get_factor(inflation_rate, ref_year, eur_year):
662+
if (pd.isna(ref_year)) or (ref_year<1900): return np.nan
663+
mean = inflation_rate.mean()
664+
if ref_year<= eur_year:
665+
new_index = np.arange(ref_year, eur_year+1)
666+
df = 1 + inflation_rate.reindex(new_index).fillna(mean)
667+
return df.cumprod().shift().fillna(1).loc[eur_year]
668+
else:
669+
new_index = np.arange(eur_year, ref_year+1)
670+
df = 1 + inflation_rate.reindex(new_index).fillna(mean)
671+
return 1/df.cumprod().shift().fillna(1).loc[ref_year]
672+
673+
inflation = costs_tot.currency_year.apply(lambda x: get_factor(inflation_rate, x, snakemake.config['eur_year']))
660674

661-
inflation = (1 + snakemake.config['rate_inflation'])**(ref_year - snakemake.config['eur_year']).astype(float)
662675
paras = ["investment", "VOM", "fuel"]
663676
filter_i = costs.index.get_level_values(0).isin(techs) & costs.index.get_level_values(1).isin(paras)
664677

665-
costs.loc[filter_i, col] = costs.loc[filter_i, col].div(inflation.loc[filter_i], axis=0)
678+
costs.loc[filter_i, col] = costs.loc[filter_i, col].mul(inflation.loc[filter_i], axis=0)
666679

667680

668681
return costs
@@ -1541,7 +1554,7 @@ def carbon_flow(costs,year):
15411554
VOM = costs.loc[('BtL', 'VOM'), 'value'] + costs.loc[('Fischer-Tropsch', 'VOM'), 'value'] * efuel_scale_factor
15421555
FOM = costs.loc[('BtL', 'FOM'), 'value']
15431556
medium_out = 'oil'
1544-
currency_year = costs.loc[('BtL', 'VOM'), "currency_year"]
1557+
currency_year = costs.loc[('Fischer-Tropsch', 'investment'), "currency_year"]
15451558
source = "combination of BtL and electrofuels"
15461559

15471560
elif tech in ['biogas', 'biogas CC', 'biogas plus hydrogen']:
@@ -1574,7 +1587,7 @@ def carbon_flow(costs,year):
15741587
costs.loc[(tech, 'VOM'), 'value'] = VOM
15751588
costs.loc[(tech, 'VOM'), 'unit'] = "EUR/MWh_th"
15761589
costs.loc[(tech, 'VOM'), 'source'] = source
1577-
costs.loc[(tech, 'VOM'), 'source'] = currency_year
1590+
costs.loc[(tech, 'VOM'), 'currency_year'] = currency_year
15781591

15791592
return costs
15801593

@@ -2103,6 +2116,18 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
21032116
return pd.concat([costs, df]), tech
21042117

21052118

2119+
def prepare_inflation_rate(fn):
2120+
"""read in annual inflation rate from Eurostat
2121+
https://ec.europa.eu/eurostat/databrowser/view/teicp000/default/table?lang=en
2122+
"""
2123+
inflation_rate = pd.read_excel(fn,
2124+
sheet_name="Blatt 1", index_col=0,
2125+
header=[8]).dropna(axis=0)
2126+
inflation_rate.rename(index=lambda x: int(x), inplace=True)
2127+
inflation_rate = inflation_rate.astype(float)
2128+
2129+
return inflation_rate.iloc[:,0]/100
2130+
21062131
# %% *************************************************************************
21072132
# ---------- MAIN ------------------------------------------------------------
21082133
if __name__ == "__main__":
@@ -2113,6 +2138,9 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
21132138
snakemake = mock_snakemake("compile_cost_assumptions")
21142139

21152140
years = snakemake.config['years']
2141+
inflation_rate = prepare_inflation_rate(snakemake.input.inflation_rate)
2142+
2143+
21162144

21172145
# (1) DEA data
21182146
# (a)-------- get data from DEA excel sheets ----------------------------------
@@ -2280,7 +2308,9 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
22802308

22812309
# adjust for inflation
22822310
techs = costs_tot.index.get_level_values(0).unique()
2283-
costs_tot = adjust_for_inflation(costs_tot, techs, costs_tot.currency_year, ["value"])
2311+
costs_tot["currency_year"] = costs_tot.currency_year.astype(float)
2312+
costs_tot = adjust_for_inflation(inflation_rate, costs_tot, techs,
2313+
costs_tot.currency_year, ["value"])
22842314

22852315
# format and sort
22862316
costs_tot.sort_index(inplace=True)

0 commit comments

Comments
 (0)