Skip to content

Commit

Permalink
Fixes an issue where passing a new attributes to IDF.simulate would f…
Browse files Browse the repository at this point in the history
…ail to create a new cache (#436)

* Fixes an issue where passing a new attributes to IDF.simulate would fail to create a new cache

* reformat
  • Loading branch information
samuelduchesne committed Jan 29, 2023
1 parent 440e06b commit a854409
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions archetypal/idfclass/idf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import io
import itertools
import logging
import logging as lg
import math
import os
Expand Down Expand Up @@ -1377,14 +1378,20 @@ def simulate(self, force=False, **kwargs):
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():
setattr(self, key, value)
else:
log(
f"IDF.simulate got invalid keyword '{key}'. Ignored",
level=logging.WARNING,
)

if (
self.simulation_dir.exists() and not force
): # don't simulate if results exists
return self

if self.as_version is not None:
if self.as_version != EnergyPlusVersion(self.idd_version):
Expand Down

0 comments on commit a854409

Please sign in to comment.