Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow-Up: Unsustainable Biomass #1254

Merged
merged 9 commits into from
Sep 8, 2024
Empty file modified rules/build_sector.smk
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions scripts/build_biomass_potentials.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def add_unsustainable_potentials(df):
)

share_sus = params.get("share_sustainable_potential_available").get(investment_year)
df *= share_sus
df.loc[df_wo_ch.index] *= share_sus

df = df.join(df_wo_ch.filter(like="unsustainable")).fillna(0)

Expand All @@ -347,8 +347,8 @@ def add_unsustainable_potentials(df):
snakemake = mock_snakemake(
"build_biomass_potentials",
simpl="",
clusters="37",
planning_horizons=2020,
clusters="38",
planning_horizons=2050,
)

configure_logging(snakemake)
Expand Down
55 changes: 49 additions & 6 deletions scripts/prepare_sector_network.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2465,14 +2465,20 @@ def add_biomass(n, costs):
e_max_pu=e_max_pu,
)

e_max_pu = pd.DataFrame(1, index=n.snapshots, columns=spatial.biomass.nodes)
e_max_pu.iloc[-1] = 0
n.madd(
"Bus",
spatial.biomass.nodes,
suffix=" unsustainable",
location=spatial.biomass.locations,
carrier="unsustainable solid biomass",
unit="MWh_LHV",
)

n.madd(
"Store",
spatial.biomass.nodes,
suffix=" unsustainable",
bus=spatial.biomass.nodes,
bus=spatial.biomass.nodes + " unsustainable",
carrier="unsustainable solid biomass",
e_nom=unsustainable_solid_biomass_potentials_spatial,
marginal_cost=costs.at["fuelwood", "fuel"],
Expand All @@ -2481,6 +2487,17 @@ def add_biomass(n, costs):
e_max_pu=e_max_pu,
)

n.madd(
"Link",
spatial.biomass.nodes,
suffix=" unsustainable",
bus0=spatial.biomass.nodes + " unsustainable",
bus1=spatial.biomass.nodes,
carrier="unsustainable solid biomass",
efficiency=1,
p_nom=unsustainable_solid_biomass_potentials_spatial,
)

n.madd(
"Bus",
spatial.biomass.bioliquids,
Expand All @@ -2507,6 +2524,8 @@ def add_biomass(n, costs):
e_max_pu=e_max_pu,
)

add_carrier_buses(n, "oil")

n.madd(
"Link",
spatial.biomass.bioliquids,
Expand Down Expand Up @@ -2629,10 +2648,29 @@ def add_biomass(n, costs):
"GlobalConstraint",
"biomass limit",
carrier_attribute="solid biomass",
sense="<=",
sense="==",
cpschau marked this conversation as resolved.
Show resolved Hide resolved
constant=biomass_potentials["solid biomass"].sum(),
type="operational_limit",
)
if biomass_potentials["unsustainable solid biomass"].sum() > 0:
n.madd(
"Generator",
spatial.biomass.nodes,
suffix=" unsustainable",
bus=spatial.biomass.nodes + " unsustainable",
carrier="unsustainable solid biomass",
p_nom=10000,
marginal_cost=costs.at["fuelwood", "fuel"]
+ bus_transport_costs * average_distance,
)
n.add(
"GlobalConstraint",
"unsustainable biomass limit",
carrier_attribute="unsustainable solid biomass",
sense="==",
constant=biomass_potentials["unsustainable solid biomass"].sum(),
type="operational_limit",
)

if options["municipal_solid_waste"]:
# Add municipal solid waste
Expand Down Expand Up @@ -4240,16 +4278,21 @@ def add_enhanced_geothermal(n, egs_potentials, egs_overlap, costs):
if __name__ == "__main__":
if "snakemake" not in globals():

import os

from _helpers import mock_snakemake

# Change directory to this script
os.chdir(os.path.dirname(os.path.realpath(__file__)))

snakemake = mock_snakemake(
"prepare_sector_network",
simpl="",
opts="",
clusters="37",
clusters="38",
ll="vopt",
sector_opts="",
planning_horizons="2050",
planning_horizons="2030",
)

configure_logging(snakemake)
Expand Down
Loading