solve_network: activate co2 seq constraint
Snakefile: retrieve data bundle from pypsaeur function
This commit is contained in:
parent
99c0882bab
commit
f4d0415cf0
@ -252,9 +252,9 @@ rule build_biomass_potentials:
|
|||||||
enspreso_biomass=HTTP.remote("https://cidportal.jrc.ec.europa.eu/ftp/jrc-opendata/ENSPRESO/ENSPRESO_BIOMASS.xlsx", keep_local=True),
|
enspreso_biomass=HTTP.remote("https://cidportal.jrc.ec.europa.eu/ftp/jrc-opendata/ENSPRESO/ENSPRESO_BIOMASS.xlsx", keep_local=True),
|
||||||
nuts2="data/nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", # https://gisco-services.ec.europa.eu/distribution/v2/nuts/download/#nuts21
|
nuts2="data/nuts/NUTS_RG_10M_2013_4326_LEVL_2.geojson", # https://gisco-services.ec.europa.eu/distribution/v2/nuts/download/#nuts21
|
||||||
regions_onshore=pypsaeur("resources/regions_onshore_elec_s{simpl}_{clusters}.geojson"),
|
regions_onshore=pypsaeur("resources/regions_onshore_elec_s{simpl}_{clusters}.geojson"),
|
||||||
nuts3_population="../pypsa-eur/data/bundle/nama_10r_3popgdp.tsv.gz",
|
nuts3_population=pypsaeur("data/bundle/nama_10r_3popgdp.tsv.gz"),
|
||||||
swiss_cantons="../pypsa-eur/data/bundle/ch_cantons.csv",
|
swiss_cantons=pypsaeur("data/bundle/ch_cantons.csv"),
|
||||||
swiss_population="../pypsa-eur/data/bundle/je-e-21.03.02.xls",
|
swiss_population=pypsaeur("data/bundle/je-e-21.03.02.xls"),
|
||||||
country_shapes=pypsaeur('resources/country_shapes.geojson')
|
country_shapes=pypsaeur('resources/country_shapes.geojson')
|
||||||
output:
|
output:
|
||||||
biomass_potentials_all='resources/biomass_potentials_all_s{simpl}_{clusters}.csv',
|
biomass_potentials_all='resources/biomass_potentials_all_s{simpl}_{clusters}.csv',
|
||||||
|
@ -100,16 +100,18 @@ def prepare_network(n, solve_opts=None):
|
|||||||
|
|
||||||
def add_battery_constraints(n):
|
def add_battery_constraints(n):
|
||||||
"""
|
"""
|
||||||
Add constraints to ensure that the ratio between the charger and
|
Add constraint ensuring that charger = discharger:
|
||||||
discharger.
|
|
||||||
1 * charger_size - efficiency * discharger_size = 0
|
1 * charger_size - efficiency * discharger_size = 0
|
||||||
"""
|
"""
|
||||||
nodes = n.buses.index[n.buses.carrier == "battery"]
|
discharger_bool = n.links.index.str.contains("battery discharger")
|
||||||
if nodes.empty:
|
charger_bool = n.links.index.str.contains("battery charger")
|
||||||
return
|
|
||||||
link_p_nom = n.model["Link-p_nom"]
|
dischargers_ext= n.links[discharger_bool].query("p_nom_extendable").index
|
||||||
eff = n.links.efficiency[nodes + " discharger"].values
|
chargers_ext= n.links[charger_bool].query("p_nom_extendable").index
|
||||||
lhs = link_p_nom.loc[nodes + ' charger'] - link_p_nom.loc[nodes + ' discharger'] * eff
|
|
||||||
|
eff = n.links.efficiency[dischargers_ext].values
|
||||||
|
lhs = n.model["Link-p_nom"].loc[chargers_ext] - n.model["Link-p_nom"].loc[dischargers_ext] * eff
|
||||||
|
|
||||||
n.model.add_constraints(lhs == 0, name="Link-charger_ratio")
|
n.model.add_constraints(lhs == 0, name="Link-charger_ratio")
|
||||||
|
|
||||||
|
|
||||||
@ -194,7 +196,7 @@ def add_co2_sequestration_limit(n, sns):
|
|||||||
def extra_functionality(n, snapshots):
|
def extra_functionality(n, snapshots):
|
||||||
add_battery_constraints(n)
|
add_battery_constraints(n)
|
||||||
add_pipe_retrofit_constraint(n)
|
add_pipe_retrofit_constraint(n)
|
||||||
# add_co2_sequestration_limit(n, snapshots)
|
add_co2_sequestration_limit(n, snapshots)
|
||||||
|
|
||||||
|
|
||||||
def solve_network(n, config, opts="", **kwargs):
|
def solve_network(n, config, opts="", **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user