From d27fee7e775415c502436e22b66ccc12527fb7db Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 6 Mar 2023 14:47:46 +0100 Subject: [PATCH] align cost fill values to pypsa-eur implementation --- config.default.yaml | 3 --- scripts/add_existing_baseyear.py | 3 +-- scripts/make_summary.py | 3 +-- scripts/prepare_sector_network.py | 20 ++++---------------- 4 files changed, 6 insertions(+), 23 deletions(-) diff --git a/config.default.yaml b/config.default.yaml index 0b03b9fb..ff0e9eef 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -579,9 +579,6 @@ costs: lifetime: 25 "CO2 intensity": 0 "discount rate": 0.07 - lifetime: 25 #default lifetime - # From a Lion Hirth paper, also reflects average of Noothout et al 2016 - discountrate: 0.07 # Marginal and capital costs can be overwritten # capital_cost: # onwind: 500 diff --git a/scripts/add_existing_baseyear.py b/scripts/add_existing_baseyear.py index 9eecaadc..bd6183e5 100644 --- a/scripts/add_existing_baseyear.py +++ b/scripts/add_existing_baseyear.py @@ -630,9 +630,8 @@ if __name__ == "__main__": Nyears = n.snapshot_weightings.generators.sum() / 8760.0 costs = prepare_costs( snakemake.input.costs, - snakemake.config["costs"]["discountrate"], + snakemake.config["costs"], Nyears, - snakemake.config["costs"]["lifetime"], ) grouping_years_power = snakemake.config["existing_capacities"][ diff --git a/scripts/make_summary.py b/scripts/make_summary.py index cf258544..70e161cc 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -693,9 +693,8 @@ if __name__ == "__main__": costs_db = prepare_costs( snakemake.input.costs, - snakemake.config["costs"]["discountrate"], + snakemake.config["costs"], Nyears, - snakemake.config["costs"]["lifetime"], ) df = make_summaries(networks_dict) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 6f8afd7f..d2f7af41 100644 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -724,8 +724,7 @@ def cycling_shift(df, steps=1): return df -# TODO checkout PyPSA-Eur script -def prepare_costs(cost_file, discount_rate, Nyears, lifetime): +def prepare_costs(cost_file, config, Nyears): # set all asset costs and other parameters costs = pd.read_csv(cost_file, index_col=[0, 1]).sort_index() @@ -736,18 +735,8 @@ def prepare_costs(cost_file, discount_rate, Nyears, lifetime): costs = ( costs.loc[:, "value"].unstack(level=1).groupby("technology").sum(min_count=1) ) - costs = costs.fillna( - { - "CO2 intensity": 0, - "FOM": 0, - "VOM": 0, - "discount rate": discount_rate, - "efficiency": 1, - "fuel": 0, - "investment": 0, - "lifetime": lifetime, - } - ) + + costs = costs.fillna(config["fill_values"]) annuity_factor = ( lambda v: annuity(v["lifetime"], v["discount rate"]) + v["FOM"] / 100 @@ -3265,9 +3254,8 @@ if __name__ == "__main__": costs = prepare_costs( snakemake.input.costs, - snakemake.config["costs"]["discountrate"], + snakemake.config["costs"], Nyears, - snakemake.config["costs"]["lifetime"], ) pop_weighted_energy_totals = pd.read_csv(