Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I254 set expandobjects #254

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions eppy/runner/run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ def run(
idf_path = os.path.abspath(idf.idfname)
except AttributeError:
idf_path = os.path.abspath(idf)
if not os.path.isfile(idf_path):
raise EnergyPlusRunError(
"ERROR: Could not find input data file: {}".format(idf_path)
)
if not expandobjects:
with open(idf_path, "r") as f:
args["expandobjects"] = "HVACTEMPLATE:" in f.read().upper()
ep_version = args.pop("ep_version")
# get version from IDF object or by parsing the IDF file for it
if not ep_version:
Expand Down
20 changes: 20 additions & 0 deletions eppy/tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,26 @@ def test_run_expandobjects(self, test_idf):
self.expected_files.extend(["eplusout.expidf"])
assert set(files) == set(self.expected_files)

def test_run_expandobjects_no_flag(self, test_idf):
"""
End to end test of idf.run function with expandobjects flag unset.
Fails on severe errors or unexpected/missing output files.

"""
test_idf.newidfobject(
"HVACTEMPLATE:THERMOSTAT",
Name="TestThermostat",
Cooling_Setpoint_Schedule_Name="",
Heating_Setpoint_Schedule_Name="",
Constant_Cooling_Setpoint=25,
Constant_Heating_Setpoint=21,
)
test_idf.run(output_directory="run_outputs")
assert not has_severe_errors()
files = os.listdir("run_outputs")
self.expected_files.extend(["eplusout.expidf"])
assert set(files) == set(self.expected_files)

def test_run_output_prefix(self, test_idf):
"""
End to end test of idf.run function with output prefix set.
Expand Down