Skip to content

Commit

Permalink
Merge 660f01d into fd09f69
Browse files Browse the repository at this point in the history
  • Loading branch information
louisleroy5 committed Nov 28, 2019
2 parents fd09f69 + 660f01d commit 09b97df
Show file tree
Hide file tree
Showing 18 changed files with 18,780 additions and 310 deletions.
45 changes: 36 additions & 9 deletions archetypal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def cli(

@cli.command()
@click.argument("idf-file", type=click.Path(exists=True))
@click.argument("weather-file", type=click.Path(exists=True))
@click.argument(
"output-folder", type=click.Path(exists=True), required=False, default="."
)
Expand Down Expand Up @@ -221,16 +222,31 @@ def cli(
"--log-clear-names",
is_flag=True,
default=False,
help='Do not print log of "clear_names" (equivalence between '
"old and new names) in the console",
help='If mentioned (True), DO NOT print log of "clear_names" (equivalence between '
"old and new names) in the console. Default (not mentioned) is False.",
)
@click.option(
"--schedule-as-input",
is_flag=True,
default=True,
help="If mentioned (False), writes schedules as SCHEDULES in BUI file. Be aware that "
"this option might make crash TRNBuild. Default (not mentioned) is True, and "
"writes the schedules as INPUTS. This option requires the user to link "
"(in the TRNSYS Studio) the csv file containing the schedules with those INPUTS",
)
@click.option(
"--ep-version",
type=str,
default=None,
help="Specify the EnergyPlus version to use. Default = None",
)
@click.option(
"--window",
nargs=4,
nargs=6,
type=float,
default=(2.2, 0.64, 0.8, 0.05),
default=(2.2, 0.64, 0.8, 0.05, 0.15, 8.17),
help="Specify window properties <u_value> <shgc> <t_vis> "
"<tolerance>. Default = 2.2 0.64 0.8 0.05",
"<tolerance> <fframe> <uframe>. Default = 2.2 0.64 0.8 0.05 0.15 8.17",
)
@click.option("--ordered", is_flag=True, help="sort idf object names")
@click.option("--nonum", is_flag=True, default=False, help="Do not renumber surfaces")
Expand All @@ -247,16 +263,17 @@ def cli(
"--refarea",
is_flag=True,
default=False,
help="Upadtes floor reference area of airnodes",
help="Updates floor reference area of airnodes",
)
@click.option(
"--volume", is_flag=True, default=False, help="Upadtes volume of airnodes"
"--volume", is_flag=True, default=False, help="Updates volume of airnodes"
)
@click.option(
"--capacitance", is_flag=True, default=False, help="Upadtes capacitance of airnodes"
"--capacitance", is_flag=True, default=False, help="Updates capacitance of airnodes"
)
def convert(
idf_file,
weather_file,
window_lib,
return_idf,
return_t3d,
Expand All @@ -265,6 +282,8 @@ def convert(
trnsidf_exe,
template,
log_clear_names,
schedule_as_input,
ep_version,
window,
ordered,
nonum,
Expand All @@ -279,6 +298,7 @@ def convert(
Args:
idf_file:
weather_file:
window_lib:
return_idf:
return_t3d:
Expand All @@ -287,6 +307,8 @@ def convert(
trnsidf_exe:
template:
log_clear_names:
schedule_as_input:
ep_version:
window:
ordered:
nonum:
Expand All @@ -296,16 +318,19 @@ def convert(
volume:
capacitance:
"""
u_value, shgc, t_vis, tolerance = window
u_value, shgc, t_vis, tolerance, fframe, uframe = window
window_kwds = {
"u_value": u_value,
"shgc": shgc,
"t_vis": t_vis,
"tolerance": tolerance,
"fframe": fframe,
"uframe": uframe,
}
with cd(output_folder):
paths = convert_idf_to_trnbuild(
idf_file,
weather_file,
window_lib,
return_idf,
True,
Expand All @@ -315,6 +340,8 @@ def convert(
trnsidf_exe,
template,
log_clear_names=log_clear_names,
schedule_as_input=schedule_as_input,
ep_version=ep_version,
**window_kwds,
ordered=ordered,
nonum=nonum,
Expand Down
19 changes: 18 additions & 1 deletion archetypal/idfclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(self, *args, **kwargs):
self._sql_file = None
self.schedules_dict = self.get_all_schedules()
self._sql = None
self._htm = None
self.eplus_run_options = EnergyPlusOptions(
eplus_file=self.idfname,
weather_file=getattr(self, "epw", None),
Expand Down Expand Up @@ -94,6 +95,16 @@ def sql(self):
else:
return self._sql

@property
def htm(self):
if self._htm is None:
self._htm = self.run_eplus(
annual=True, prep_outputs=True, output_report="htm"
)
return self._htm
else:
return self._htm

@property
def sql_file(self):
if self._sql_file is None:
Expand Down Expand Up @@ -550,7 +561,7 @@ def get_used_schedules(self, yearly_only=False):
for fieldvalue in object.fieldvalues:
try:
if (
fieldvalue in all_schedules
fieldvalue.upper() in all_schedules.keys()
and fieldvalue not in used_schedules
):
used_schedules.append(fieldvalue)
Expand Down Expand Up @@ -1738,6 +1749,12 @@ def run_eplus(
idf = load_idf(
eplus_file, output_folder=output_directory, include=include
)
runargs["output_report"] = "sql"
idf._sql = get_report(**runargs)
runargs["output_report"] = "sql_file"
idf._sql_file = get_report(**runargs)
runargs["output_report"] = "htm"
idf._htm = get_report(**runargs)
else:
idf = None
return_elements = list(
Expand Down
2 changes: 1 addition & 1 deletion archetypal/reportdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def from_sqlite(
sql_query = sql_query.replace(";", """ AND (%s);""" % conditions)
params.update(env_name)
df = cls.execute(conn, sql_query, params)
return df
return cls(df)

@classmethod
def multiple_conditions(cls, basename, cond_names, var_name):
Expand Down
1 change: 0 additions & 1 deletion archetypal/ressources/originBUISketchUp.idf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
!-*--------------------------------------------------------------------------------
!-INPUTS TGROUND TBOUNDARY SHADE_CLOSE SHADE_OPEN MAX_ISHADE MAX_ESHADE
!-INPUTS_DESCRIPTION
!- TGROUND : C : Ground Temperature (boundary temperature used for floors adjacent to the ground)
!- TBOUNDARY : C : Boundary Temperature (boundary temperature used for boundary floors, walls, ceilings)
!- SHADE_CLOSE : kJ/hr.m^2 : threshold of total radiation on facade where shading device is activated
!- SHADE_OPEN : kJ/hr.m^2 : threshold of total radiation on facade where shading device is deactivated
Expand Down
Loading

0 comments on commit 09b97df

Please sign in to comment.