Skip to content

Commit

Permalink
Merge pull request #732 from openego/features/import-object-before-op…
Browse files Browse the repository at this point in the history
…timization

Add try/except statement to allow importing etrago object before optimization when "market-grid" is selected
  • Loading branch information
ClaraBuettner authored Mar 12, 2024
2 parents c866fc7 + f2c8b1b commit 697e871
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions etrago/tools/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,22 @@ def __init__(
)

if self.args["method"]["type"] == "market_grid":
self.market_model = Network(
csv_folder_name + "/market", name, ignore_standard_types
)
try:
self.market_model = Network(
csv_folder_name + "/market",
name,
ignore_standard_types,
)
except ValueError:
logger.warning(
"""
Could not import a market_model but the selected
method in the args indicated that it should be there.
This happens when the exported network was not solved
yet.Run 'etrago.optimize()' to build and solve the
market model.
"""
)

self.get_clustering_data(csv_folder_name)

Expand Down

0 comments on commit 697e871

Please sign in to comment.