pre-commit formatting [no ci]
This commit is contained in:
parent
65b05e92a1
commit
a2012d8937
@ -148,7 +148,11 @@ def add_everywhere_powerplants(ppl, substations, everywhere_powerplants):
|
||||
|
||||
|
||||
def replace_natural_gas_technology(df):
|
||||
mapping = {"Steam Turbine": "CCGT", "Combustion Engine": "OCGT", "Not Found": "CCGT"}
|
||||
mapping = {
|
||||
"Steam Turbine": "CCGT",
|
||||
"Combustion Engine": "OCGT",
|
||||
"Not Found": "CCGT",
|
||||
}
|
||||
tech = df.Technology.replace(mapping).fillna("CCGT")
|
||||
return df.Technology.mask(df.Fueltype == "Natural Gas", tech)
|
||||
|
||||
|
@ -973,7 +973,9 @@ def insert_electricity_distribution_grid(n, costs):
|
||||
.get("electricity distribution grid", {})
|
||||
.get("efficiency_static")
|
||||
):
|
||||
logger.info(f"Deducting distribution losses from electricity demand: {100*(1-efficiency)}%")
|
||||
logger.info(
|
||||
f"Deducting distribution losses from electricity demand: {100*(1-efficiency)}%"
|
||||
)
|
||||
n.loads_t.p_set.loc[:, n.loads.carrier == "electricity"] *= efficiency
|
||||
|
||||
# this catches regular electricity load and "industry electricity" and
|
||||
|
@ -531,28 +531,39 @@ def add_CCL_constraints(n, config):
|
||||
agg_p_nom_limits: data/agg_p_nom_minmax.csv
|
||||
"""
|
||||
agg_p_nom_minmax = pd.read_csv(
|
||||
config["solving"]["agg_p_nom_limits"]["file"],
|
||||
index_col=[0, 1], header=[0, 1]
|
||||
config["solving"]["agg_p_nom_limits"]["file"], index_col=[0, 1], header=[0, 1]
|
||||
)[snakemake.wildcards.planning_horizons]
|
||||
logger.info("Adding generation capacity constraints per carrier and country")
|
||||
p_nom = n.model["Generator-p_nom"]
|
||||
|
||||
gens = n.generators.query("p_nom_extendable").rename_axis(index="Generator-ext")
|
||||
if config["solving"]["agg_p_nom_limits"]["agg_offwind"]:
|
||||
rename_offwind = {"offwind-ac": "offwind-all", "offwind-dc": "offwind-all", "offwind": "offwind-all"}
|
||||
rename_offwind = {
|
||||
"offwind-ac": "offwind-all",
|
||||
"offwind-dc": "offwind-all",
|
||||
"offwind": "offwind-all",
|
||||
}
|
||||
gens = gens.replace(rename_offwind)
|
||||
grouper = pd.concat([gens.bus.map(n.buses.country), gens.carrier], axis=1)
|
||||
lhs = p_nom.groupby(grouper).sum().rename(bus="country")
|
||||
|
||||
if config["solving"]["agg_p_nom_limits"]["include_existing"]:
|
||||
gens_cst = n.generators.query("~p_nom_extendable").rename_axis(index="Generator-cst")
|
||||
gens_cst = n.generators.query("~p_nom_extendable").rename_axis(
|
||||
index="Generator-cst"
|
||||
)
|
||||
gens_cst = gens_cst[
|
||||
(gens_cst["build_year"] + gens_cst["lifetime"]) >= int(snakemake.wildcards.planning_horizons)]
|
||||
(gens_cst["build_year"] + gens_cst["lifetime"])
|
||||
>= int(snakemake.wildcards.planning_horizons)
|
||||
]
|
||||
if config["solving"]["agg_p_nom_limits"]["agg_offwind"]:
|
||||
gens_cst = gens_cst.replace(rename_offwind)
|
||||
rhs_cst = (
|
||||
pd.concat([gens_cst.bus.map(n.buses.country), gens_cst[["carrier", "p_nom"]]], axis=1)
|
||||
.groupby(["bus", "carrier"]).sum()
|
||||
pd.concat(
|
||||
[gens_cst.bus.map(n.buses.country), gens_cst[["carrier", "p_nom"]]],
|
||||
axis=1,
|
||||
)
|
||||
.groupby(["bus", "carrier"])
|
||||
.sum()
|
||||
)
|
||||
rhs_cst.index = rhs_cst.index.rename({"bus": "country"})
|
||||
rhs_min = agg_p_nom_minmax["min"].dropna()
|
||||
|
Loading…
Reference in New Issue
Block a user