From cfeb7d641e3008a49463408d20e457a9b74cccbe Mon Sep 17 00:00:00 2001 From: LukasFrankenQ Date: Fri, 4 Aug 2023 01:27:26 +0100 Subject: [PATCH] bug fix in heat pump load, added standing loss --- scripts/prepare_network.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/scripts/prepare_network.py b/scripts/prepare_network.py index d41532e5..1a79cd24 100755 --- a/scripts/prepare_network.py +++ b/scripts/prepare_network.py @@ -547,6 +547,18 @@ def add_heat_pump_load( p_set=hp_heat_demand, ) + n.madd( + "Link", + gb_nodes, + suffix = " heat pump", + bus0=gb_nodes, + bus1=gb_nodes + " elec heat demand", + carrier="heat pump", + p_nom_extendable=True, + capital_cost=0., + marginal_cost=0., + ) + import matplotlib.pyplot as plt fig, ax = plt.subplots(1, 1, figsize=(16, 4)) @@ -572,6 +584,8 @@ def add_heat_pump_load( shift_size = snakemake.config["flexibility"]["heat_shift_size"] + standing_loss = snakemake.config["flexibility"]["hourly_heat_loss"] + s = n.snapshots logger.warning("Check timezone-issue!!") @@ -650,6 +664,7 @@ def add_heat_pump_load( bus=gb_nodes + " thermal inertia", e_nom=e_nom, e_max_pu=e_max_pu, + standing_loss=standing_loss, ) n.madd( @@ -1281,11 +1296,13 @@ def add_batteries(n): flexopts = snakemake.wildcards.flexopts.split("-") - assert sum(list(map(lambda x: x in {"ss", "reg", "bev", "heat"}, flexopts))) == len(flexopts), ( - "flexopts must be a combination of 'ss', 'reg', 'bev', 'heat', currently is {}".format( - snakemake.wildcards.flexopts + print(flexopts) + if not (len(flexopts) == 1 and "" in flexopts): + assert sum(list(map(lambda x: x in {"ss", "reg", "bev", "heat"}, flexopts))) == len(flexopts), ( + "flexopts must be a combination of 'ss', 'reg', 'bev', 'heat', currently is {}".format( + snakemake.wildcards.flexopts + ) ) - ) logger.info(f"Using Flexibility Options: {flexopts}")