[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot] 2023-05-27 10:23:28 +00:00
parent 1c73bb0342
commit ead87afce1
4 changed files with 37 additions and 19 deletions

View File

@ -7,11 +7,15 @@ rule solve_network:
params: params:
solving=config["solving"], solving=config["solving"],
config_parts={ config_parts={
"foresight":config["foresight"], "foresight": config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"], "planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200), "co2_sequestration_potential": config["sector"].get(
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"] "co2_sequestration_potential", 200
}, ),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input: input:
network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc", network=RESOURCES + "networks/elec_s{simpl}_{clusters}_ec_l{ll}_{opts}.nc",
output: output:

View File

@ -85,11 +85,15 @@ rule solve_sector_network_myopic:
params: params:
solving=config["solving"], solving=config["solving"],
config_parts={ config_parts={
"foresight":config["foresight"], "foresight": config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"], "planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200), "co2_sequestration_potential": config["sector"].get(
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"] "co2_sequestration_potential", 200
}, ),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
network=RESULTS network=RESULTS

View File

@ -7,11 +7,15 @@ rule solve_sector_network:
params: params:
solving=config["solving"], solving=config["solving"],
config_parts={ config_parts={
"foresight":config["foresight"], "foresight": config["foresight"],
"planning_horizons":config["scenario"]["planning_horizons"], "planning_horizons": config["scenario"]["planning_horizons"],
"co2_sequestration_potential":config["sector"].get("co2_sequestration_potential", 200), "co2_sequestration_potential": config["sector"].get(
"H2_retrofit_capacity_per_CH4":config["sector"]["H2_retrofit_capacity_per_CH4"] "co2_sequestration_potential", 200
}, ),
"H2_retrofit_capacity_per_CH4": config["sector"][
"H2_retrofit_capacity_per_CH4"
],
},
input: input:
overrides="data/override_component_attrs", overrides="data/override_component_attrs",
network=RESULTS network=RESULTS

View File

@ -222,7 +222,7 @@ def add_CCL_constraints(n, config):
agg_p_nom_limits: data/agg_p_nom_minmax.csv agg_p_nom_limits: data/agg_p_nom_minmax.csv
""" """
agg_p_nom_minmax = pd.read_csv( agg_p_nom_minmax = pd.read_csv(
config['electricity']["agg_p_nom_limits"], index_col=[0, 1] config["electricity"]["agg_p_nom_limits"], index_col=[0, 1]
) )
logger.info("Adding generation capacity constraints per carrier and country") logger.info("Adding generation capacity constraints per carrier and country")
p_nom = n.model["Generator-p_nom"] p_nom = n.model["Generator-p_nom"]
@ -370,7 +370,7 @@ def add_SAFE_constraints(n, config):
Which sets a reserve margin of 10% above the peak demand. Which sets a reserve margin of 10% above the peak demand.
""" """
peakdemand = n.loads_t.p_set.sum(axis=1).max() peakdemand = n.loads_t.p_set.sum(axis=1).max()
margin = 1.0 + config['electricity']["SAFE_reservemargin"] margin = 1.0 + config["electricity"]["SAFE_reservemargin"]
reserve_margin = peakdemand * margin reserve_margin = peakdemand * margin
# TODO: do not take this from the plotting config! # TODO: do not take this from the plotting config!
conv_techs = config["plotting"]["conv_techs"] conv_techs = config["plotting"]["conv_techs"]
@ -675,10 +675,16 @@ if __name__ == "__main__":
else: else:
n = pypsa.Network(snakemake.input.network) n = pypsa.Network(snakemake.input.network)
n = prepare_network(n, solve_opts, config=snakemake.config, param=snakemake.params["config_parts"]) n = prepare_network(
n, solve_opts, config=snakemake.config, param=snakemake.params["config_parts"]
)
n = solve_network( n = solve_network(
n, config=snakemake.config, solving_param=snakemake.params["solving"], opts=opts, log_fn=snakemake.log.solver n,
config=snakemake.config,
solving_param=snakemake.params["solving"],
opts=opts,
log_fn=snakemake.log.solver,
) )
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards))) n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))