fix all lv references to ll, pickup right location of default lifetime

This commit is contained in:
Fabian Neumann 2023-03-06 17:18:07 +01:00
parent 511f30d520
commit 76d57731ec
3 changed files with 12 additions and 12 deletions

View File

@ -160,7 +160,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
mean = df_agg.loc[biomass_i, "DateIn"].mean()
df_agg.loc[biomass_i, "DateIn"] = df_agg.loc[biomass_i, "DateIn"].fillna(int(mean))
# Fill missing DateOut
dateout = df_agg.loc[biomass_i, "DateIn"] + snakemake.config["costs"]["lifetime"]
dateout = df_agg.loc[biomass_i, "DateIn"] + snakemake.config["costs"]['fill_values']["lifetime"]
df_agg.loc[biomass_i, "DateOut"] = df_agg.loc[biomass_i, "DateOut"].fillna(dateout)
# drop assets which are already phased out / decommissioned
@ -654,7 +654,7 @@ if __name__ == "__main__":
.to_pandas()
.reindex(index=n.snapshots)
)
default_lifetime = snakemake.config["costs"]["lifetime"]
default_lifetime = snakemake.config["costs"]['fill_values']["lifetime"]
add_heating_capacities_installed_before_baseyear(
n,
baseyear,

View File

@ -208,15 +208,15 @@ def calculate_cumulative_cost():
# integrate cost throughout the transition path
for r in cumulative_cost.columns:
for cluster in cumulative_cost.index.get_level_values(level=0).unique():
for lv in cumulative_cost.index.get_level_values(level=1).unique():
for ll in cumulative_cost.index.get_level_values(level=1).unique():
for sector_opts in cumulative_cost.index.get_level_values(
level=2
).unique():
cumulative_cost.loc[
(cluster, lv, sector_opts, "cumulative cost"), r
(cluster, ll, sector_opts, "cumulative cost"), r
] = np.trapz(
cumulative_cost.loc[
idx[cluster, lv, sector_opts, planning_horizons], r
idx[cluster, ll, sector_opts, planning_horizons], r
].values,
x=planning_horizons,
)
@ -639,7 +639,7 @@ def make_summaries(networks_dict):
]
columns = pd.MultiIndex.from_tuples(
networks_dict.keys(), names=["cluster", "lv", "opt", "planning_horizon"]
networks_dict.keys(), names=["cluster", "ll", "opt", "planning_horizon"]
)
df = {}
@ -676,14 +676,14 @@ if __name__ == "__main__":
logging.basicConfig(level=snakemake.config["logging"]["level"])
networks_dict = {
(cluster, lv, opt + sector_opt, planning_horizon): "results/"
(cluster, ll, opt + sector_opt, planning_horizon): "results/"
+ snakemake.params.RDIR
+ f"/postnetworks/elec_s{simpl}_{cluster}_lv{lv}_{opt}_{sector_opt}_{planning_horizon}.nc"
+ f"/postnetworks/elec_s{simpl}_{cluster}_l{ll}_{opt}_{sector_opt}_{planning_horizon}.nc"
for simpl in snakemake.config["scenario"]["simpl"]
for cluster in snakemake.config["scenario"]["clusters"]
for opt in snakemake.config["scenario"]["opts"]
for sector_opt in snakemake.config["scenario"]["sector_opts"]
for lv in snakemake.config["scenario"]["lv"]
for ll in snakemake.config["scenario"]["ll"]
for planning_horizon in snakemake.config["scenario"]["planning_horizons"]
}

View File

@ -136,7 +136,7 @@ def plot_map(
ac_color = "rosybrown"
dc_color = "darkseagreen"
if snakemake.wildcards["lv"] == "1.0":
if snakemake.wildcards["ll"] == "v1.0":
# should be zero
line_widths = n.lines.s_nom_opt - n.lines.s_nom
link_widths = n.links.p_nom_opt - n.links.p_nom
@ -698,7 +698,7 @@ def plot_map_without(network):
to_drop = n.links.index[(n.links.carrier != "DC") & (n.links.carrier != "B2B")]
n.links.drop(to_drop, inplace=True)
if snakemake.wildcards["lv"] == "1.0":
if snakemake.wildcards["ll"] == "v1.0":
line_widths = n.lines.s_nom
link_widths = n.links.p_nom
else:
@ -895,7 +895,7 @@ def plot_series(network, carrier="AC", name="test"):
"{}/{RDIR}maps/series-{}-{}-{}-{}-{}.pdf".format(
"results",
snakemake.params.RDIR,
snakemake.wildcards["lv"],
snakemake.wildcards["ll"],
carrier,
start,
stop,