Skip to content

Commit

Permalink
Apply black
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaraBuettner committed Aug 13, 2024
1 parent c3cb6a4 commit ae18e9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
26 changes: 15 additions & 11 deletions etrago/execute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ def run_lopf(etrago, extra_functionality, method):
)
)[0]


# repeat the optimization for all slices
for i in range(0, no_slices):
# keep information on the initial state of charge for the
Expand Down Expand Up @@ -176,18 +175,23 @@ def run_lopf(etrago, extra_functionality, method):
formulation=etrago.args["model_formulation"],
)

if etrago.network_tsa.results["Solver"][0]["Status"] != "ok":
if (
etrago.network_tsa.results["Solver"][0]["Status"]
!= "ok"
):
raise Exception("LOPF not solved.")
else:
raise Exception("Temporal disaggregation currently only works when using pyomo.")
raise Exception(
"Temporal disaggregation currently only works when using pyomo."
)
status, termination_condition = network_lopf(
etrago.network_tsa,
etrago.network_tsa.snapshots[start : end + 1],
solver_name=etrago.args["solver"],
solver_options=etrago.args["solver_options"],
extra_functionality=extra_functionality,
formulation=etrago.args["model_formulation"],
)
etrago.network_tsa,
etrago.network_tsa.snapshots[start : end + 1],
solver_name=etrago.args["solver"],
solver_options=etrago.args["solver_options"],
extra_functionality=extra_functionality,
formulation=etrago.args["model_formulation"],
)
if status != "ok":
raise Exception("LOPF not solved.")

Expand Down Expand Up @@ -423,7 +427,7 @@ def optimize(self):
"""

if self.args["method"]["market_optimization"]:
if self.args["method"]["market_optimization"]["active"]:
self.market_optimization()

# self.market_results_to_grid()
Expand Down
15 changes: 8 additions & 7 deletions etrago/tools/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2608,13 +2608,14 @@ def check_args(etrago):
raise

if (etrago.args["method"]["formulation"] != "pyomo") & (
etrago.args["temporal_disaggregation"]["active"]):
logger.warning(
"Temporal disaggregation is"
" not yet correctly implemented without pyomo."
" Setting `args['method']['formulation']` to `pyomo`."
)
etrago.args["method"]["formulation"] = "pyomo"
etrago.args["temporal_disaggregation"]["active"]
):
logger.warning(
"Temporal disaggregation is"
" not yet correctly implemented without pyomo."
" Setting `args['method']['formulation']` to `pyomo`."
)
etrago.args["method"]["formulation"] = "pyomo"


def drop_sectors(self, drop_carriers):
Expand Down

0 comments on commit ae18e9d

Please sign in to comment.