prepare_sector: add biomass transport costs for networks wo biomass network

This commit is contained in:
Fabian 2023-07-31 12:23:03 +02:00
parent 266c0fd9ef
commit 03e3278f89
2 changed files with 43 additions and 36 deletions

View File

@ -295,35 +295,25 @@ rule build_biomass_potentials:
"../scripts/build_biomass_potentials.py" "../scripts/build_biomass_potentials.py"
if config["sector"]["biomass_transport"]: rule build_biomass_transport_costs:
input:
rule build_biomass_transport_costs: transport_cost_data=HTTP.remote(
input: "publications.jrc.ec.europa.eu/repository/bitstream/JRC98626/biomass potentials in europe_web rev.pdf",
transport_cost_data=HTTP.remote( keep_local=True,
"publications.jrc.ec.europa.eu/repository/bitstream/JRC98626/biomass potentials in europe_web rev.pdf", ),
keep_local=True, output:
), biomass_transport_costs=RESOURCES + "biomass_transport_costs.csv",
output: threads: 1
biomass_transport_costs=RESOURCES + "biomass_transport_costs.csv", resources:
threads: 1 mem_mb=1000,
resources: log:
mem_mb=1000, LOGS + "build_biomass_transport_costs.log",
log: benchmark:
LOGS + "build_biomass_transport_costs.log", BENCHMARKS + "build_biomass_transport_costs"
benchmark: conda:
BENCHMARKS + "build_biomass_transport_costs" "../envs/environment.yaml"
conda: script:
"../envs/environment.yaml" "../scripts/build_biomass_transport_costs.py"
script:
"../scripts/build_biomass_transport_costs.py"
build_biomass_transport_costs_output = rules.build_biomass_transport_costs.output
if not config["sector"]["biomass_transport"]:
# this is effecively an `else` statement which is however not liked by snakefmt
build_biomass_transport_costs_output = {}
if config["sector"]["regional_co2_sequestration_potential"]["enable"]: if config["sector"]["regional_co2_sequestration_potential"]["enable"]:
@ -721,7 +711,7 @@ rule prepare_sector_network:
RDIR=RDIR, RDIR=RDIR,
input: input:
**build_retro_cost_output, **build_retro_cost_output,
**build_biomass_transport_costs_output, **rules.build_biomass_transport_costs.output,
**gas_infrastructure, **gas_infrastructure,
**build_sequestration_potentials_output, **build_sequestration_potentials_output,
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
@ -782,7 +772,7 @@ rule prepare_sector_network:
+ "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc", + "prenetworks/elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
threads: 1 threads: 1
resources: resources:
mem_mb=2000, mem_mb=20000,
log: log:
LOGS LOGS
+ "prepare_sector_network_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log", + "prepare_sector_network_elec_s{simpl}_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.log",

View File

@ -2155,12 +2155,12 @@ def add_biomass(n, costs):
p_nom_extendable=True, p_nom_extendable=True,
) )
if options["biomass_transport"]: transport_costs = pd.read_csv(
transport_costs = pd.read_csv( snakemake.input.biomass_transport_costs,
snakemake.input.biomass_transport_costs, index_col=0,
index_col=0, ).squeeze()
).squeeze()
if options["biomass_transport"]:
# add biomass transport # add biomass transport
biomass_transport = create_network_topology( biomass_transport = create_network_topology(
n, "biomass transport ", bidirectional=False n, "biomass transport ", bidirectional=False
@ -2185,6 +2185,23 @@ def add_biomass(n, costs):
carrier="solid biomass transport", carrier="solid biomass transport",
) )
elif options["biomass_spatial"]:
# add artificial biomass generators at nodes which include transport costs
bus_transport_costs = spatial.biomass.nodes.to_series().apply(
lambda x: transport_costs[x[:2]]
)
average_distance = 200 # km #TODO: validate this assumption
n.madd(
"Generator",
spatial.biomass.nodes,
bus=spatial.biomass.nodes,
carrier="solid biomass",
p_nom=10000,
marginal_cost=costs.at["solid biomass", "fuel"]
+ bus_transport_costs * average_distance,
)
# AC buses with district heating # AC buses with district heating
urban_central = n.buses.index[n.buses.carrier == "urban central heat"] urban_central = n.buses.index[n.buses.carrier == "urban central heat"]
if not urban_central.empty and options["chp"]: if not urban_central.empty and options["chp"]: