Skip to content

Commit

Permalink
Changes behavior of IDF.simulate to return results directly if they e…
Browse files Browse the repository at this point in the history
…xist (#218)
  • Loading branch information
Samuel Letellier-Duchesne committed Sep 2, 2021
1 parent bd97a8f commit 7093ef4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions archetypal/idfclass/idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,14 +1240,17 @@ def variables(self):
self._variables = Variables(self)
return self._variables

def simulate(self, **kwargs):
def simulate(self, force=False, **kwargs):
"""Execute EnergyPlus.
Specified kwargs overwrite IDF parameters. ExpandObjects, Basement and Slab
preprocessors are ran before EnergyPlus.
Does not return anything.
Args:
force (bool): Force simulation even though results exist in `self.simulation_dir`.
Keyword Args:
eplus_file (str): path to the idf file.
weather_file (str): path to the EPW weather file.
Expand Down Expand Up @@ -1302,9 +1305,11 @@ def simulate(self, **kwargs):
energyplus command.
See Also:
:meth:`simulation_files`, :meth:`processed_results` for simulation outputs.
:attr:`IDF.simulation_files`, :attr:`IDF.processed_results` for simulation outputs.
"""
if self.simulation_dir.exists() and not force: # don't simulate if results exists
return self
# First, update keys with new values
for key, value in kwargs.items():
if f"_{key}" in self.__dict__.keys():
Expand Down

0 comments on commit 7093ef4

Please sign in to comment.