Skip to content

Commit

Permalink
Merge branch 'paper/kmedoids-dijkstra-2' of https://github.com/openeg…
Browse files Browse the repository at this point in the history
…o/eTraGo into paper/kmedoids-dijkstra-2
  • Loading branch information
KathiEsterl committed May 15, 2024
2 parents c5a94d5 + 4f7f76c commit 80da97d
Show file tree
Hide file tree
Showing 2 changed files with 799 additions and 21 deletions.
47 changes: 26 additions & 21 deletions etrago/appl_ehv.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"FeasibilityTol": 1e-05,
"crossover": 0,
"logFile": "solver_etrago.log",
"threads": 10,
"threads": 16,
"method": 2,
"BarHomogeneous": 1
},
Expand Down Expand Up @@ -139,7 +139,7 @@
"random_state": 42, # random state for replicability of kmeans results
"active": True, # choose if clustering is activated
"method": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_AC": 30, # total number of resulting AC nodes (DE+foreign)
"n_clusters_AC": 300, # total number of resulting AC nodes (DE+foreign)
"cluster_foreign_AC": False, # take foreign AC buses into account, True or False
"method_gas": "kmedoids-dijkstra", # choose clustering method: kmeans or kmedoids-dijkstra
"n_clusters_gas": 17, # total number of resulting CH4 nodes (DE+foreign)
Expand All @@ -156,7 +156,7 @@
"n_init": 10, # affects clustering algorithm, only change when neccesary
"max_iter": 100, # affects clustering algorithm, only change when neccesary
"tol": 1e-6, # affects clustering algorithm, only change when neccesary
"CPU_cores": 10, # number of cores used during clustering. "max" for all cores available.
"CPU_cores": 16, # number of cores used during clustering. "max" for all cores available.
},
"sector_coupled_clustering": {
"active": True, # choose if clustering is activated
Expand Down Expand Up @@ -483,19 +483,23 @@ def run_etrago(args, json_path):

# import network from database
etrago.build_network_from_db()

print(' ')
print(etrago.network.buses.carrier.unique())
print(' ')

etrago.network.transformers.loc["99999", :] = etrago.network.transformers.loc["27248",:]
etrago.network.transformers.loc["99999","bus0"] = "32756"
etrago.network.transformers.loc["99999","bus1"] = "36163"
new_trafo = etrago.network.transformers.loc["27248",:]
new_trafo["bus0"] = "32756"
new_trafo["bus1"] = "36163"
new_trafo.name = "99999"
new_trafo = new_trafo.to_frame()
new_trafo = new_trafo.T
etrago.network.import_components_from_dataframe(new_trafo, "Transformer" )

new_line = etrago.network.lines.loc["26463", :]
new_line["bus0"] = "32788"
new_line["bus1"] = "35597"
new_line.name = "99999"
new_line = new_line.to_frame()
new_line = new_line.T
etrago.network.import_components_from_dataframe(new_line, "Line" )

etrago.network.lines.loc["99999", :] = etrago.network.lines.loc["26463", :]
etrago.network.lines.loc["99999", "bus0"] = "32788"
etrago.network.lines.loc["99999", "bus1"] = "32786"

etrago.network.storage_units.lifetime = np.inf
etrago.network.transformers.lifetime = 40 # only temporal fix
etrago.network.lines.lifetime = 40 # only temporal fix until either the
Expand Down Expand Up @@ -656,9 +660,9 @@ def run_etrago(args, json_path):
etrago.ehv_clustering()

print(' ')
print(etrago.network.buses)
print('spatial resolution after ehv clustering:')
print(len(etrago.network.buses))
print(' ')
print(' ')

print(' ')
print('start spatial clustering')
Expand All @@ -672,7 +676,7 @@ def run_etrago(args, json_path):
print('stop spatial clustering')
print(datetime.datetime.now())
print(' ')

from etrago.tools.utilities import modular_weight
print(' ')
print('Modularity')
Expand All @@ -698,16 +702,17 @@ def run_etrago(args, json_path):
#etrago.network.storage_units.p_nom_extendable=False
#etrago.export_to_csv("original")
#etrago = Etrago(csv_folder_name="original")
etrago.network.lines.loc[etrago.network.lines.r == 0.0, "r"] = 0.1

# start linear optimal powerflow calculations
# needs to be adjusted for new sectors
etrago.network.lines.loc[etrago.network.lines.r == 0.0, "r"] = 0.1
etrago.lopf()

# conduct lopf with full complex timeseries for dispatch disaggregation
etrago.dispatch_disaggregation()

#etrago.dispatch_disaggregation()
#etrago.network.lines.loc[etrago.network.lines.r == 0.0, "r"] = 10
# start power flow based on lopf results
etrago.pf_post_lopf()
#etrago.pf_post_lopf()

# spatial disaggregation
# needs to be adjusted for new sectors
Expand Down
Loading

0 comments on commit 80da97d

Please sign in to comment.