Skip to content

Commit

Permalink
Merge branch 'exec' into outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelduchesne committed Aug 30, 2021
2 parents 800f25e + a4b3eaf commit 91de531
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 41 deletions.
28 changes: 13 additions & 15 deletions archetypal/eplus_interface/basement.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,10 @@ def run(self):

# Get executable using shutil.which (determines the extension based on
# the platform, eg: .exe. And copy the executable to tmp
self.basement_exe = Path(
shutil.which(
"Basement", path=self.eplus_home / "PreProcess" / "GrndTempCalc"
)
).copy(self.run_dir)
self.basement_idd = (
self.eplus_home / "PreProcess" / "GrndTempCalc" / "BasementGHT.idd"
).copy(self.run_dir)
self.basement_exe = Path(shutil.which("Basement", path=self.eplus_home)).copy(
self.run_dir
)
self.basement_idd = (self.eplus_home / "BasementGHT.idd").copy(self.run_dir)
self.outfile = self.idf.name

# The BasementGHTin.idf file is copied from the self.include list (
Expand Down Expand Up @@ -207,11 +203,13 @@ def cancelled_callback(self, stdin, stdout):

@property
def eplus_home(self):
eplus_exe, eplus_home = paths_from_version(self.idf.as_version.dash)
if not Path(eplus_home).exists():
raise EnergyPlusVersionError(
msg=f"No EnergyPlus Executable found for version "
f"{EnergyPlusVersion(self.idf.as_version)}"
)
"""Get the version-dependant directory where executables are installed."""
if self.idf.file_version <= EnergyPlusVersion("7.2"):
install_dir = self.idf.file_version.current_install_dir / "bin"
else:
return Path(eplus_home)
install_dir = (
self.idf.file_version.current_install_dir
/ "PreProcess"
/ "GrndTempCalc"
)
return install_dir
17 changes: 7 additions & 10 deletions archetypal/eplus_interface/expand_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ def run(self):
self.epw = self.idf.epw.copy(tmp / "in.epw").expand()
self.idfname = Path(self.idf.savecopy(tmp / "in.idf")).expand()
self.idd = self.idf.iddname.copy(tmp / "Energy+.idd").expand()
self.expandobjectsexe = Path(
shutil.which("ExpandObjects", path=self.eplus_home.expand())
).copy2(tmp)
expand_object_exe = shutil.which("ExpandObjects", path=self.eplus_home)
self.expandobjectsexe = Path(expand_object_exe).copy2(tmp)
self.run_dir = Path(tmp).expand()

# Run ExpandObjects Program
Expand Down Expand Up @@ -151,11 +150,9 @@ def cancelled_callback(self, stdin, stdout):

@property
def eplus_home(self):
eplus_exe, eplus_home = paths_from_version(self.idf.as_version.dash)
if not Path(eplus_home).exists():
raise EnergyPlusVersionError(
msg=f"No EnergyPlus Executable found for version "
f"{EnergyPlusVersion(self.idf.as_version)}"
)
"""Get the version-dependant directory where executables are installed."""
if self.idf.file_version <= EnergyPlusVersion("7.2"):
install_dir = self.idf.file_version.current_install_dir / "bin"
else:
return Path(eplus_home)
install_dir = self.idf.file_version.current_install_dir
return install_dir
26 changes: 13 additions & 13 deletions archetypal/eplus_interface/slab.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ def run(self):

# Get executable using shutil.which (determines the extension based on
# the platform, eg: .exe. And copy the executable to tmp
self.slabexe = Path(
shutil.which("Slab", path=self.eplus_home / "PreProcess" / "GrndTempCalc")
).copy(self.run_dir)
self.slabidd = (
self.eplus_home / "PreProcess" / "GrndTempCalc" / "SlabGHT.idd"
).copy(self.run_dir)
self.slabexe = Path(shutil.which("Slab", path=self.eplus_home)).copy(
self.run_dir
)
self.slabidd = (self.eplus_home / "SlabGHT.idd").copy(self.run_dir)

# The GHTin.idf file is copied from the self.include list (added by
# ExpandObjects. If self.include is empty, no need to run Slab.
Expand Down Expand Up @@ -164,11 +162,13 @@ def cancelled_callback(self, stdin, stdout):

@property
def eplus_home(self):
eplus_exe, eplus_home = paths_from_version(self.idf.as_version.dash)
if not Path(eplus_home).exists():
raise EnergyPlusVersionError(
msg=f"No EnergyPlus Executable found for version "
f"{EnergyPlusVersion(self.idf.as_version)}"
)
"""Get the version-dependant directory where executables are installed."""
if self.idf.file_version <= EnergyPlusVersion("7.2"):
install_dir = self.idf.file_version.current_install_dir / "bin"
else:
return Path(eplus_home)
install_dir = (
self.idf.file_version.current_install_dir
/ "PreProcess"
/ "GrndTempCalc"
)
return install_dir
4 changes: 1 addition & 3 deletions archetypal/eplus_interface/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
from path import Path

from archetypal import settings
from archetypal.eplus_interface.exceptions import (
InvalidEnergyPlusVersion,
)
from archetypal.eplus_interface.exceptions import InvalidEnergyPlusVersion


class EnergyPlusVersion(Version):
Expand Down

0 comments on commit 91de531

Please sign in to comment.