Skip to content

Commit

Permalink
Add try/except statement to allow importing etrago object before opti…
Browse files Browse the repository at this point in the history
…mization when "market-grid" is selected
  • Loading branch information
ClaraBuettner committed Mar 5, 2024
1 parent 9168b9b commit f2c8b1b
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 f2c8b1b

Please sign in to comment.