Merge branch 'co2limit' of https://github.com/fneum/pypsa-eur into fneum-co2limit
This commit is contained in:
commit
82392c6c07
@ -7,7 +7,7 @@ wildcard_constraints:
|
||||
simpl="[a-zA-Z0-9]*|all",
|
||||
clusters="[0-9]+m?|all",
|
||||
sectors="[+a-zA-Z0-9]+",
|
||||
opts="[-+a-zA-Z0-9]*"
|
||||
opts="[-+a-zA-Z0-9\.]*"
|
||||
|
||||
rule cluster_all_elec_networks:
|
||||
input:
|
||||
|
@ -23,6 +23,7 @@ enable:
|
||||
electricity:
|
||||
voltages: [220., 300., 380.]
|
||||
co2limit: 7.75e+7 # 0.05 * 3.1e9*0.5
|
||||
co2base: 3.1e+9 # 1 * 3.1e9*0.5
|
||||
agg_p_nom_limits: data/agg_p_nom_minmax.csv
|
||||
|
||||
extendable_carriers:
|
||||
|
@ -66,10 +66,16 @@ import geopandas as gpd
|
||||
import pypsa
|
||||
from add_electricity import load_costs, update_transmission_costs
|
||||
|
||||
def add_co2limit(n, Nyears=1.):
|
||||
def add_co2limit(n, Nyears=1., factor=None):
|
||||
|
||||
if factor is not None:
|
||||
annual_emissions = factor*snakemake.config['electricity']['co2base']
|
||||
else:
|
||||
annual_emissions = snakemake.config['electricity']['co2limit']
|
||||
|
||||
n.add("GlobalConstraint", "CO2Limit",
|
||||
carrier_attribute="co2_emissions", sense="<=",
|
||||
constant=snakemake.config['electricity']['co2limit'] * Nyears)
|
||||
constant=annual_emissions * Nyears)
|
||||
|
||||
def add_emission_prices(n, emission_prices=None, exclude_co2=False):
|
||||
assert False, "Needs to be fixed, adds NAN"
|
||||
@ -201,9 +207,13 @@ if __name__ == "__main__":
|
||||
else:
|
||||
logger.info("No resampling")
|
||||
|
||||
if 'Co2L' in opts:
|
||||
add_co2limit(n, Nyears)
|
||||
# add_emission_prices(n, exclude_co2=True)
|
||||
for o in opts:
|
||||
if "Co2L" in o:
|
||||
m = re.findall("[0-9]*\.?[0-9]+$", o)
|
||||
if len(m) > 0:
|
||||
add_co2limit(n, Nyears, float(m[0]))
|
||||
else:
|
||||
add_co2limit(n, Nyears)
|
||||
|
||||
# if 'Ep' in opts:
|
||||
# add_emission_prices(n)
|
||||
|
Loading…
Reference in New Issue
Block a user