adjustments to new due to clustering module

This commit is contained in:
Fabian 2023-07-11 12:40:25 +02:00
parent c7f67f0641
commit 9fbc626862
4 changed files with 19 additions and 18 deletions

View File

@ -621,14 +621,10 @@ clustering:
exclude_carriers: []
aggregation_strategies:
generators:
p_nom_max: sum # use "min" for more conservative assumptions
p_nom_min: sum
p_min_pu: mean
marginal_cost: mean
p_nom_max: weighted_min
committable: any
ramp_limit_up: max
ramp_limit_down: max
efficiency: mean
solving:
#tmpdir: "path/to/tmp"
@ -775,6 +771,8 @@ plotting:
H2: "Hydrogen Storage"
lines: "Transmission Lines"
ror: "Run of River"
ac: "AC"
dc: "DC"
tech_colors:
# wind

View File

@ -499,13 +499,6 @@ if __name__ == "__main__":
Nyears,
).at["HVAC overhead", "capital_cost"]
def consense(x):
v = x.iat[0]
assert (
x == v
).all() or x.isnull().all(), "The `potential` configuration option must agree for all renewable carriers, for now!"
return v
custom_busmap = params.custom_busmap
if custom_busmap:
custom_busmap = pd.read_csv(

View File

@ -36,7 +36,11 @@ if __name__ == "__main__":
# %%
def rename_index(ds):
return ds.set_axis(ds.index.map(lambda x: f"{x[1]}\n({x[0].lower()})"))
specific = ds.index.map(lambda x: f"{x[1]}\n({x[0].lower()})")
generic = ds.index.get_level_values("carrier")
duplicated = generic.duplicated(keep=False)
index = specific.where(duplicated, generic)
return ds.set_axis(index)
def plot_static_per_carrier(ds, ax, drop_zero=True):
if drop_zero:

View File

@ -256,8 +256,12 @@ def _aggregate_and_move_components(
_, generator_strategies = get_aggregation_strategies(aggregation_strategies)
carriers = set(n.generators.carrier) - set(exclude_carriers)
generators, generators_pnl = aggregategenerators(
n, busmap, carriers=carriers, custom_strategies=generator_strategies
generators, generators_pnl = aggregateoneport(
n,
busmap,
"Generator",
carriers=carriers,
custom_strategies=generator_strategies,
)
replace_components(n, "Generator", generators, generators_pnl)
@ -602,14 +606,16 @@ if __name__ == "__main__":
# some entries in n.buses are not updated in previous functions, therefore can be wrong. as they are not needed
# and are lost when clustering (for example with the simpl wildcard), we remove them for consistency:
buses_c = {
remove = [
"symbol",
"tags",
"under_construction",
"substation_lv",
"substation_off",
}.intersection(n.buses.columns)
n.buses = n.buses.drop(buses_c, axis=1)
"geometry",
]
n.buses.drop(remove, axis=1, inplace=True, errors="ignore")
n.lines.drop(remove, axis=1, errors="ignore", inplace=True)
update_p_nom_max(n)