add switch for msw waste

This commit is contained in:
lisazeyen 2024-08-05 10:32:22 +02:00
parent f58322c3e5
commit a56834e51e
2 changed files with 71 additions and 53 deletions

View File

@ -600,6 +600,7 @@ sector:
biomass_to_liquid: false biomass_to_liquid: false
electrobiofuels: false electrobiofuels: false
biosng: false biosng: false
municipal_solid_waste: false
limit_max_growth: limit_max_growth:
enable: false enable: false
# allowing 30% larger than max historic growth # allowing 30% larger than max historic growth
@ -627,6 +628,7 @@ sector:
max_amount: 1390 # TWh max_amount: 1390 # TWh
upstream_emissions_factor: .1 #share of solid biomass CO2 emissions at full combustion upstream_emissions_factor: .1 #share of solid biomass CO2 emissions at full combustion
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#industry # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#industry
industry: industry:
St_primary_fraction: St_primary_fraction:

View File

@ -2266,8 +2266,38 @@ def add_biomass(n, costs):
n.add("Carrier", "biogas") n.add("Carrier", "biogas")
n.add("Carrier", "solid biomass") n.add("Carrier", "solid biomass")
n.add("Carrier", "municipal solid waste")
if (options["municipal_solid_waste"] and not options["industry"]
and cf_industry["waste_to_energy"] or cf_industry["waste_to_energy_cc"]):
logger.warning("Flag municipal_solid_waste can be only used with industry "
"sector waste to energy."
"Setting municipal_solid_waste=False.")
options["municipal_solid_waste"] = False
if options["municipal_solid_waste"]:
n.add("Carrier", "municipal solid waste")
n.madd(
"Bus",
spatial.msw.nodes,
location=spatial.msw.locations,
carrier="municipal solid waste",
)
e_max_pu = pd.Series([1] * (len(n.snapshots) - 1) + [0], index=n.snapshots)
n.madd(
"Store",
spatial.msw.nodes,
bus=spatial.msw.nodes,
carrier="municipal solid waste",
e_nom=msw_biomass_potentials_spatial,
marginal_cost=0, # costs.at["municipal solid waste", "fuel"],
e_max_pu=e_max_pu,
e_initial=msw_biomass_potentials_spatial,
)
n.madd( n.madd(
"Bus", "Bus",
spatial.gas.biogas, spatial.gas.biogas,
@ -2284,12 +2314,6 @@ def add_biomass(n, costs):
unit="MWh_LHV", unit="MWh_LHV",
) )
n.madd(
"Bus",
spatial.msw.nodes,
location=spatial.msw.locations,
carrier="municipal solid waste",
)
n.madd( n.madd(
"Store", "Store",
@ -2358,18 +2382,8 @@ def add_biomass(n, costs):
* costs.at["solid biomass", "CO2 intensity"], * costs.at["solid biomass", "CO2 intensity"],
p_nom_extendable=True, p_nom_extendable=True,
) )
e_max_pu = pd.Series([1] * (len(n.snapshots) - 1) + [0], index=n.snapshots)
n.madd(
"Store",
spatial.msw.nodes,
bus=spatial.msw.nodes,
carrier="municipal solid waste",
e_nom=msw_biomass_potentials_spatial,
marginal_cost=0, # costs.at["municipal solid waste", "fuel"],
e_max_pu=e_max_pu,
e_initial=msw_biomass_potentials_spatial,
)
n.madd( n.madd(
"Link", "Link",
@ -2441,18 +2455,19 @@ def add_biomass(n, costs):
marginal_cost=biomass_transport.costs * biomass_transport.length.values, marginal_cost=biomass_transport.costs * biomass_transport.length.values,
carrier="solid biomass transport", carrier="solid biomass transport",
) )
n.madd( if options["municipal_solid_waste"]:
"Link", n.madd(
biomass_transport.index, "Link",
bus0=biomass_transport.bus0 + " municipal solid waste", biomass_transport.index,
bus1=biomass_transport.bus1 + " municipal solid waste", bus0=biomass_transport.bus0 + " municipal solid waste",
p_nom_extendable=False, bus1=biomass_transport.bus1 + " municipal solid waste",
p_nom=5e4, p_nom_extendable=False,
length=biomass_transport.length.values, p_nom=5e4,
marginal_cost=biomass_transport.costs * biomass_transport.length.values, length=biomass_transport.length.values,
carrier="municipal solid waste transport", marginal_cost=biomass_transport.costs * biomass_transport.length.values,
) carrier="municipal solid waste transport",
)
elif options["biomass_spatial"]: elif options["biomass_spatial"]:
# add artificial biomass generators at nodes which include transport costs # add artificial biomass generators at nodes which include transport costs
@ -2482,25 +2497,26 @@ def add_biomass(n, costs):
constant=biomass_potentials["solid biomass"].sum(), constant=biomass_potentials["solid biomass"].sum(),
type="operational_limit", type="operational_limit",
) )
# Add municipal solid waste if options["municipal_solid_waste"]:
n.madd( # Add municipal solid waste
"Generator", n.madd(
spatial.msw.nodes, "Generator",
bus=spatial.msw.nodes, spatial.msw.nodes,
carrier="municipal solid waste", bus=spatial.msw.nodes,
p_nom=10000, carrier="municipal solid waste",
marginal_cost=0 # costs.at["municipal solid waste", "fuel"] p_nom=10000,
+ bus_transport_costs * average_distance, marginal_cost=0 # costs.at["municipal solid waste", "fuel"]
) + bus_transport_costs * average_distance,
n.add( )
"GlobalConstraint", n.add(
"msw limit", "GlobalConstraint",
carrier_attribute="municipal solid waste", "msw limit",
sense="<=", carrier_attribute="municipal solid waste",
constant=biomass_potentials["municipal solid waste"].sum(), sense="<=",
type="operational_limit", constant=biomass_potentials["municipal solid waste"].sum(),
) type="operational_limit",
)
# 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"]
@ -3207,7 +3223,7 @@ def add_industry(n, costs):
efficiency3=process_co2_per_naphtha, efficiency3=process_co2_per_naphtha,
) )
if options.get("biomass", True): if options.get("biomass", True) and options["municipal_solid_waste"]:
n.madd( n.madd(
"Link", "Link",
spatial.msw.locations, spatial.msw.locations,
@ -4110,7 +4126,7 @@ if __name__ == "__main__":
"prepare_sector_network", "prepare_sector_network",
simpl="", simpl="",
opts="", opts="",
clusters="1", clusters="37",
ll="vopt", ll="vopt",
sector_opts="", sector_opts="",
planning_horizons="2050", planning_horizons="2050",