Skip to content

Commit

Permalink
Do not store and load busmap from csv file when market model is build
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Nov 5, 2024
1 parent 4e84603 commit 03118bd
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions etrago/cluster/electrical.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,24 +856,8 @@ def postprocessing(
method = settings["method"]
num_clusters = settings["n_clusters_AC"]

if not settings["k_elec_busmap"]:
busmap.name = "cluster"
busmap_elec = pd.DataFrame(busmap.copy(), dtype="string")
busmap_elec.index.name = "bus"
busmap_elec = busmap_elec.join(busmap_foreign, how="outer")
busmap_elec = busmap_elec.join(
pd.Series(
medoid_idx.index.values.astype(str),
medoid_idx,
name="medoid_idx",
)
)

busmap_elec.to_csv(
f"{method}_elecgrid_busmap_{num_clusters}_result.csv"
)
if ((settings["k_elec_busmap"] != False) & (apply_on != "market_model")):

else:
logger.info("Import Busmap for spatial clustering")
busmap_foreign = pd.read_csv(
settings["k_elec_busmap"],
Expand All @@ -897,6 +881,23 @@ def postprocessing(
medoid_idx.index.values.astype(str), medoid_idx.values.astype(int)
)

else:
busmap.name = "cluster"
busmap_elec = pd.DataFrame(busmap.copy(), dtype="string")
busmap_elec.index.name = "bus"
busmap_elec = busmap_elec.join(busmap_foreign, how="outer")
busmap_elec = busmap_elec.join(
pd.Series(
medoid_idx.index.values.astype(str),
medoid_idx,
name="medoid_idx",
)
)

busmap_elec.to_csv(
f"{method}_elecgrid_busmap_{num_clusters}_result.csv"
)

network, busmap = adjust_no_electric_network(
etrago, busmap, cluster_met=method, apply_on=apply_on
)
Expand Down

0 comments on commit 03118bd

Please sign in to comment.