Merge pull request #711 from PyPSA/biomass-transport-costs
prepare_sector: add biomass transport costs for networks wo biomass network
This commit is contained in:
commit
9687fef2e2
@ -295,7 +295,7 @@ rule build_biomass_potentials:
|
||||
"../scripts/build_biomass_potentials.py"
|
||||
|
||||
|
||||
if config["sector"]["biomass_transport"]:
|
||||
if config["sector"]["biomass_transport"] or config["sector"]["biomass_spatial"]:
|
||||
|
||||
rule build_biomass_transport_costs:
|
||||
input:
|
||||
@ -320,9 +320,8 @@ if config["sector"]["biomass_transport"]:
|
||||
build_biomass_transport_costs_output = rules.build_biomass_transport_costs.output
|
||||
|
||||
|
||||
if not config["sector"]["biomass_transport"]:
|
||||
if not (config["sector"]["biomass_transport"] or config["sector"]["biomass_spatial"]):
|
||||
# this is effecively an `else` statement which is however not liked by snakefmt
|
||||
|
||||
build_biomass_transport_costs_output = {}
|
||||
|
||||
|
||||
|
@ -2156,12 +2156,11 @@ def add_biomass(n, costs):
|
||||
)
|
||||
|
||||
if options["biomass_transport"]:
|
||||
transport_costs = pd.read_csv(
|
||||
snakemake.input.biomass_transport_costs,
|
||||
index_col=0,
|
||||
).squeeze()
|
||||
|
||||
# add biomass transport
|
||||
transport_costs = pd.read_csv(
|
||||
snakemake.input.biomass_transport_costs, index_col=0
|
||||
)
|
||||
transport_costs = transport_costs.squeeze()
|
||||
biomass_transport = create_network_topology(
|
||||
n, "biomass transport ", bidirectional=False
|
||||
)
|
||||
@ -2185,6 +2184,27 @@ def add_biomass(n, costs):
|
||||
carrier="solid biomass transport",
|
||||
)
|
||||
|
||||
elif options["biomass_spatial"]:
|
||||
# add artificial biomass generators at nodes which include transport costs
|
||||
transport_costs = pd.read_csv(
|
||||
snakemake.input.biomass_transport_costs, index_col=0
|
||||
)
|
||||
transport_costs = transport_costs.squeeze()
|
||||
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
|
||||
urban_central = n.buses.index[n.buses.carrier == "urban central heat"]
|
||||
if not urban_central.empty and options["chp"]:
|
||||
|
Loading…
Reference in New Issue
Block a user