Skip to content

Commit

Permalink
Benders Step set Xpansion directory
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zakir committed Oct 16, 2023
1 parent 678f91b commit 64fb0bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/python/antares_xpansion/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ def _set_last_simulation_name(self):
self._last_study = self.last_modified_study(self.antares_output())

self._set_xpansion_simulation_name()
class NotAnXpansionOutputDir(Exception):
pass


def _set_xpansion_simulation_name(self):
if self.step() in ["resume", "sensitivity"] :
Expand All @@ -512,6 +515,11 @@ def _set_xpansion_simulation_name(self):
self._xpansion_simulation_name = self._last_study.parent / self._last_study.stem
with zipfile.ZipFile(self._last_study, 'r') as output_zip:
output_zip.extractall(self._xpansion_simulation_name)
elif self.step() == "benders":
if(not self._last_study.name.endswith("-Xpansion")):
raise ConfigLoader.NotAnXpansionOutputDir(f"Error! {self._last_study} is not an Xpansion output directory")
self._xpansion_simulation_name = self._last_study

else:
self._xpansion_simulation_name = self._last_study.parent / \
(self._last_study.stem+"-Xpansion")
Expand Down

0 comments on commit 64fb0bd

Please sign in to comment.