Skip to content

Commit

Permalink
Merge pull request #720 from openego/fixes/#719-select_elec_network-i…
Browse files Browse the repository at this point in the history
…ncompatible-with-market-optimization

adjust function select_elec_network
  • Loading branch information
ClaraBuettner committed Feb 28, 2024
2 parents 49eb0f0 + 205b84f commit 9168b9b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
22 changes: 21 additions & 1 deletion etrago/cluster/electrical.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ def select_elec_network(etrago, apply_on="grid_model"):
----------
etrago : Etrago
An instance of the Etrago class
apply_on: str
gives information about the objective of the output network. If
"grid_model" is provided, the value assigned in the args for
["network_clustering"]["cluster_foreign_AC""] will define if the
foreign buses will be included in the network. if "market_model" is
provided, foreign buses will be always included.
Returns
-------
Expand All @@ -496,7 +502,18 @@ def select_elec_network(etrago, apply_on="grid_model"):
"""
)
settings = etrago.args["network_clustering"]
if settings["cluster_foreign_AC"]:

if apply_on == "grid_model":
include_foreign = settings["cluster_foreign_AC"]
elif apply_on == "market_model":
include_foreign = True
else:
raise ValueError(
"""Parameter apply_on must be either 'grid_model' or 'market_model'
"""
)

if include_foreign:
elec_network.buses = elec_network.buses[
elec_network.buses.carrier == "AC"
]
Expand Down Expand Up @@ -653,6 +670,9 @@ def preprocessing(etrago, apply_on="grid_model"):
----------
etrago : Etrago
An instance of the Etrago class
apply_on : string
provide information about the objective of the preprocessing. Which
process is going to use the result. e.g. "grid_model", "market_model".
Returns
-------
Expand Down
4 changes: 1 addition & 3 deletions etrago/cluster/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def sum_with_inf(x):


def strategies_buses():
return {
"geom": nan_links,
}
return {"geom": nan_links, "country": "first"}


def strategies_lines():
Expand Down

0 comments on commit 9168b9b

Please sign in to comment.