From 0423366db60eacf050539f5baf74ff09294e2cf4 Mon Sep 17 00:00:00 2001 From: Fabian Hofmann Date: Mon, 9 Sep 2024 14:14:16 +0200 Subject: [PATCH] prepare_sector_network: fix e_max_pu in unsustainable biomass stores (#1266) --- scripts/prepare_sector_network.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index 8748b64f..7f744874 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -2503,7 +2503,9 @@ def add_biomass(n, costs): unit="MWh_LHV", ) - e_max_pu = pd.DataFrame(1, index=n.snapshots, columns=spatial.biomass.nodes) + e_max_pu = pd.DataFrame( + 1, index=n.snapshots, columns=spatial.biomass.nodes_unsustainable + ) e_max_pu.iloc[-1] = 0 n.madd( @@ -2694,9 +2696,12 @@ def add_biomass(n, costs): + bus_transport_costs * average_distance, ) # Set last snapshot of e_max_pu for unsustainable solid biomass to 1 to make operational limit work - unsus_stores_idx = n.stores.loc[ - n.stores.carrier == "unsustainable solid biomass" - ].index + unsus_stores_idx = n.stores.query( + "carrier == 'unsustainable solid biomass'" + ).index + unsus_stores_idx = unsus_stores_idx.intersection( + n.stores_t.e_max_pu.columns + ) n.stores_t.e_max_pu.loc[n.snapshots[-1], unsus_stores_idx] = 1 n.add( "GlobalConstraint",