honeybee-energy 1.116.13__py2.py3-none-any.whl → 1.116.14__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of honeybee-energy might be problematic. Click here for more details.
- honeybee_energy/cli/translate.py +192 -204
- honeybee_energy/construction/shade.py +1 -1
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/METADATA +1 -1
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/RECORD +8 -8
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/LICENSE +0 -0
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/WHEEL +0 -0
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/entry_points.txt +0 -0
- {honeybee_energy-1.116.13.dist-info → honeybee_energy-1.116.14.dist-info}/top_level.txt +0 -0
honeybee_energy/cli/translate.py
CHANGED
|
@@ -4,7 +4,6 @@ import sys
|
|
|
4
4
|
import os
|
|
5
5
|
import logging
|
|
6
6
|
import json
|
|
7
|
-
import re
|
|
8
7
|
import tempfile
|
|
9
8
|
|
|
10
9
|
from ladybug.commandutil import process_content_to_output
|
|
@@ -22,9 +21,7 @@ from honeybee_energy.construction.opaque import OpaqueConstruction
|
|
|
22
21
|
from honeybee_energy.construction.window import WindowConstruction
|
|
23
22
|
from honeybee_energy.schedule.dictutil import dict_to_schedule
|
|
24
23
|
from honeybee_energy.schedule.ruleset import ScheduleRuleset
|
|
25
|
-
from honeybee_energy.
|
|
26
|
-
from honeybee_energy.run import to_openstudio_sim_folder, run_osw, \
|
|
27
|
-
from_gbxml_osw, from_osm_osw, from_idf_osw, \
|
|
24
|
+
from honeybee_energy.run import to_openstudio_sim_folder, run_osw, from_osm_osw, \
|
|
28
25
|
_parse_os_cli_failure, HB_OS_MSG
|
|
29
26
|
from honeybee_energy.writer import energyplus_idf_version, _preprocess_model_for_trace
|
|
30
27
|
from honeybee_energy.config import folders
|
|
@@ -77,7 +74,7 @@ def translate():
|
|
|
77
74
|
'generated files (osw, osm, idf) if successfully'
|
|
78
75
|
' created. By default the list will be printed out to stdout',
|
|
79
76
|
type=click.File('w'), default='-', show_default=True)
|
|
80
|
-
def
|
|
77
|
+
def model_to_sim_folder(
|
|
81
78
|
model_file, epw_file, sim_par_json, measures, additional_string, additional_idf,
|
|
82
79
|
folder, log_file
|
|
83
80
|
):
|
|
@@ -554,8 +551,8 @@ def model_to_idf(
|
|
|
554
551
|
'types will be left as they are. Choose from: UndergroundSlab, '
|
|
555
552
|
'SlabOnGrade, RaisedFloor.', type=str, default='', show_default=True)
|
|
556
553
|
@click.option('--output-file', '-f', help='Optional gbXML file to output the string '
|
|
557
|
-
'of the translation. By default it printed out to stdout',
|
|
558
|
-
type=click.
|
|
554
|
+
'of the translation. By default it printed out to stdout',
|
|
555
|
+
type=click.File('w'), default='-', show_default=True)
|
|
559
556
|
def model_to_gbxml_cli(
|
|
560
557
|
model_file, osw_folder, default_subfaces, triangulate_non_planar, minimal,
|
|
561
558
|
interior_face_type, ground_face_type, output_file):
|
|
@@ -659,8 +656,8 @@ def model_to_gbxml(
|
|
|
659
656
|
default=None,
|
|
660
657
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
661
658
|
@click.option('--output-file', '-f', help='Optional gbXML file to output the string '
|
|
662
|
-
'of the translation. By default it printed out to stdout.',
|
|
663
|
-
type=click.
|
|
659
|
+
'of the translation. By default it printed out to stdout.',
|
|
660
|
+
type=click.File('w'), default='-', show_default=True)
|
|
664
661
|
def model_to_trace_gbxml_cli(
|
|
665
662
|
model_file, single_window, rect_sub_distance, frame_merge_distance,
|
|
666
663
|
osw_folder, output_file):
|
|
@@ -801,14 +798,17 @@ def model_to_sdd(model_file, osw_folder=None, output_file=None):
|
|
|
801
798
|
@translate.command('model-from-osm')
|
|
802
799
|
@click.argument('osm-file', type=click.Path(
|
|
803
800
|
exists=True, file_okay=True, dir_okay=False, resolve_path=True))
|
|
804
|
-
@click.option('--
|
|
805
|
-
'
|
|
806
|
-
'
|
|
801
|
+
@click.option('--keep-properties/--reset-properties', ' /-r', help='Flag to note '
|
|
802
|
+
'whether all energy properties should be reset to defaults upon import, '
|
|
803
|
+
'meaning that only the geometry and boundary conditions are imported '
|
|
804
|
+
'from the file.', default=True, show_default=True)
|
|
805
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
806
|
+
default=None,
|
|
807
807
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
808
808
|
@click.option('--output-file', '-f', help='Optional HBJSON file to output the string '
|
|
809
|
-
'of the translation. By default it printed out to stdout.',
|
|
810
|
-
type=click.
|
|
811
|
-
def model_from_osm_cli(osm_file, osw_folder, output_file):
|
|
809
|
+
'of the translation. By default it printed out to stdout.',
|
|
810
|
+
type=click.File('w'), default='-', show_default=True)
|
|
811
|
+
def model_from_osm_cli(osm_file, keep_properties, osw_folder, output_file):
|
|
812
812
|
"""Translate a OpenStudio Model (OSM) to a Honeybee Model (HBJSON).
|
|
813
813
|
|
|
814
814
|
\b
|
|
@@ -816,7 +816,8 @@ def model_from_osm_cli(osm_file, osw_folder, output_file):
|
|
|
816
816
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
817
817
|
"""
|
|
818
818
|
try:
|
|
819
|
-
|
|
819
|
+
reset_properties = not keep_properties
|
|
820
|
+
model_from_osm(osm_file, reset_properties, osw_folder, output_file)
|
|
820
821
|
except Exception as e:
|
|
821
822
|
_logger.exception('Model translation failed.\n{}'.format(e))
|
|
822
823
|
sys.exit(1)
|
|
@@ -824,50 +825,46 @@ def model_from_osm_cli(osm_file, osw_folder, output_file):
|
|
|
824
825
|
sys.exit(0)
|
|
825
826
|
|
|
826
827
|
|
|
827
|
-
def model_from_osm(osm_file, osw_folder=None, output_file=None
|
|
828
|
+
def model_from_osm(osm_file, reset_properties=False, osw_folder=None, output_file=None,
|
|
829
|
+
keep_properties=True):
|
|
828
830
|
"""Translate a OpenStudio Model (OSM) to a Honeybee Model (HBJSON).
|
|
829
831
|
|
|
830
832
|
Args:
|
|
831
833
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
the
|
|
834
|
+
reset_properties: Boolean to note whether all energy properties should be
|
|
835
|
+
reset to defaults upon import, meaning that only the geometry and boundary
|
|
836
|
+
conditions are imported from the Openstudio Model. (Default: False).
|
|
837
|
+
osw_folder: Deprecated input that is no longer used.
|
|
835
838
|
output_file: Optional HBJSON file to output the string of the translation.
|
|
836
839
|
If None, it will be returned from this method. (Default: None).
|
|
837
840
|
"""
|
|
838
|
-
#
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
osw = from_osm_osw(osm_file, out_f, osw_folder)
|
|
850
|
-
file_contents = _run_translation_osw(osw, out_path)
|
|
851
|
-
|
|
852
|
-
# return the file contents if requested
|
|
853
|
-
if file_contents is not None:
|
|
854
|
-
if output_file is None:
|
|
855
|
-
return file_contents
|
|
856
|
-
else:
|
|
857
|
-
print(file_contents)
|
|
841
|
+
# check that honeybee-openstudio is installed
|
|
842
|
+
try:
|
|
843
|
+
from honeybee_openstudio.reader import model_from_osm_file
|
|
844
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
845
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
846
|
+
if osw_folder is not None:
|
|
847
|
+
print('--folder is deprecated and no longer used.')
|
|
848
|
+
# translate everything to a honeybee Model
|
|
849
|
+
model = model_from_osm_file(osm_file, reset_properties)
|
|
850
|
+
# write out the file
|
|
851
|
+
return process_content_to_output(json.dumps(model.to_dict()), output_file)
|
|
858
852
|
|
|
859
853
|
|
|
860
854
|
@translate.command('model-from-idf')
|
|
861
855
|
@click.argument('idf-file', type=click.Path(
|
|
862
856
|
exists=True, file_okay=True, dir_okay=False, resolve_path=True))
|
|
863
|
-
@click.option('--
|
|
864
|
-
'
|
|
865
|
-
'
|
|
857
|
+
@click.option('--keep-properties/--reset-properties', ' /-r', help='Flag to note '
|
|
858
|
+
'whether all energy properties should be reset to defaults upon import, '
|
|
859
|
+
'meaning that only the geometry and boundary conditions are imported '
|
|
860
|
+
'from the file.', default=True, show_default=True)
|
|
861
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
862
|
+
default=None,
|
|
866
863
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
867
864
|
@click.option('--output-file', '-f', help='Optional HBJSON file to output the string '
|
|
868
|
-
'of the translation. By default it printed out to stdout',
|
|
869
|
-
type=click.
|
|
870
|
-
def model_from_idf_cli(idf_file, osw_folder, output_file):
|
|
865
|
+
'of the translation. By default it printed out to stdout',
|
|
866
|
+
type=click.File('w'), default='-', show_default=True)
|
|
867
|
+
def model_from_idf_cli(idf_file, keep_properties, osw_folder, output_file):
|
|
871
868
|
"""Translate an EnergyPlus Model (IDF) to a Honeybee Model (HBJSON).
|
|
872
869
|
|
|
873
870
|
\b
|
|
@@ -875,7 +872,8 @@ def model_from_idf_cli(idf_file, osw_folder, output_file):
|
|
|
875
872
|
idf_file: Path to an EnergyPlus Model (IDF) file.
|
|
876
873
|
"""
|
|
877
874
|
try:
|
|
878
|
-
|
|
875
|
+
reset_properties = not keep_properties
|
|
876
|
+
model_from_idf(idf_file, reset_properties, osw_folder, output_file)
|
|
879
877
|
except Exception as e:
|
|
880
878
|
_logger.exception('Model translation failed.\n{}'.format(e))
|
|
881
879
|
sys.exit(1)
|
|
@@ -883,68 +881,46 @@ def model_from_idf_cli(idf_file, osw_folder, output_file):
|
|
|
883
881
|
sys.exit(0)
|
|
884
882
|
|
|
885
883
|
|
|
886
|
-
def model_from_idf(idf_file, osw_folder=None, output_file=None
|
|
884
|
+
def model_from_idf(idf_file, reset_properties=False, osw_folder=None, output_file=None,
|
|
885
|
+
keep_properties=True):
|
|
887
886
|
"""Translate an EnergyPlus Model (IDF) to a Honeybee Model (HBJSON).
|
|
888
887
|
|
|
889
888
|
Args:
|
|
890
889
|
idf_file: Path to an EnergyPlus Model (IDF) file.
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
the
|
|
890
|
+
reset_properties: Boolean to note whether all energy properties should be
|
|
891
|
+
reset to defaults upon import, meaning that only the geometry and boundary
|
|
892
|
+
conditions are imported from the EnergyPlus Model. (Default: False).
|
|
893
|
+
osw_folder: Deprecated input that is no longer used.
|
|
894
894
|
output_file: Optional HBJSON file to output the string of the translation.
|
|
895
895
|
If None, it will be returned from this method. (Default: None).
|
|
896
896
|
"""
|
|
897
|
-
#
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
# run the measure to translate the model JSON to an openstudio measure
|
|
909
|
-
_, idf = run_osw(osw, silent=True)
|
|
910
|
-
if idf is not None and os.path.isfile(idf):
|
|
911
|
-
if out_path is not None: # load the JSON string to stdout
|
|
912
|
-
with open(out_path) as json_file:
|
|
913
|
-
file_contents = json_file.read()
|
|
914
|
-
if output_file is None:
|
|
915
|
-
return file_contents
|
|
916
|
-
else:
|
|
917
|
-
print(file_contents)
|
|
918
|
-
else:
|
|
919
|
-
# check the version of the IDF; most of the time, this is the issue
|
|
920
|
-
ver_regex = r'[V|v][E|e][R|r][S|s][I|i][O|o][N|n],\s*(\d*\.\d*)[;|.]'
|
|
921
|
-
ver_pattern = re.compile(ver_regex)
|
|
922
|
-
with open(idf_file, 'r') as mf:
|
|
923
|
-
ver_val = re.search(ver_pattern, mf.read())
|
|
924
|
-
if ver_val is not None:
|
|
925
|
-
ver_tup = tuple(int(v) for v in ver_val.groups()[0].split('.'))
|
|
926
|
-
if folders.energyplus_version[:2] != ver_tup:
|
|
927
|
-
msg = 'The IDF is from EnergyPlus version {}.\nThis must be ' \
|
|
928
|
-
'changed to {} with the IDFVersionUpdater\nin order to import ' \
|
|
929
|
-
'it with this Ladybug Tools installation.'.format(
|
|
930
|
-
'.'.join((str(v) for v in ver_tup)),
|
|
931
|
-
'.'.join((str(v) for v in folders.energyplus_version[:2]))
|
|
932
|
-
)
|
|
933
|
-
raise ValueError(msg)
|
|
934
|
-
_parse_os_cli_failure(os.path.dirname(osw))
|
|
897
|
+
# check that honeybee-openstudio is installed
|
|
898
|
+
try:
|
|
899
|
+
from honeybee_openstudio.reader import model_from_idf_file
|
|
900
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
901
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
902
|
+
if osw_folder is not None:
|
|
903
|
+
print('--folder is deprecated and no longer used.')
|
|
904
|
+
# translate everything to a honeybee Model
|
|
905
|
+
model = model_from_idf_file(idf_file, reset_properties)
|
|
906
|
+
# write out the file
|
|
907
|
+
return process_content_to_output(json.dumps(model.to_dict()), output_file)
|
|
935
908
|
|
|
936
909
|
|
|
937
910
|
@translate.command('model-from-gbxml')
|
|
938
911
|
@click.argument('gbxml-file', type=click.Path(
|
|
939
912
|
exists=True, file_okay=True, dir_okay=False, resolve_path=True))
|
|
940
|
-
@click.option('--
|
|
941
|
-
'
|
|
942
|
-
'
|
|
913
|
+
@click.option('--keep-properties/--reset-properties', ' /-r', help='Flag to note '
|
|
914
|
+
'whether all energy properties should be reset to defaults upon import, '
|
|
915
|
+
'meaning that only the geometry and boundary conditions are imported '
|
|
916
|
+
'from the file.', default=True, show_default=True)
|
|
917
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
918
|
+
default=None,
|
|
943
919
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
944
920
|
@click.option('--output-file', '-f', help='Optional HBJSON file to output the string '
|
|
945
|
-
'of the translation. By default it printed out to stdout',
|
|
946
|
-
type=click.
|
|
947
|
-
def model_from_gbxml_cli(gbxml_file, osw_folder, output_file):
|
|
921
|
+
'of the translation. By default it printed out to stdout',
|
|
922
|
+
type=click.File('w'), default='-', show_default=True)
|
|
923
|
+
def model_from_gbxml_cli(gbxml_file, keep_properties, osw_folder, output_file):
|
|
948
924
|
"""Translate a gbXML to a Honeybee Model (HBJSON).
|
|
949
925
|
|
|
950
926
|
\b
|
|
@@ -952,7 +928,8 @@ def model_from_gbxml_cli(gbxml_file, osw_folder, output_file):
|
|
|
952
928
|
gbxml_file: Path to a gbXML file.
|
|
953
929
|
"""
|
|
954
930
|
try:
|
|
955
|
-
|
|
931
|
+
reset_properties = not keep_properties
|
|
932
|
+
model_from_gbxml(gbxml_file, reset_properties, osw_folder, output_file)
|
|
956
933
|
except Exception as e:
|
|
957
934
|
_logger.exception('Model translation failed.\n{}'.format(e))
|
|
958
935
|
sys.exit(1)
|
|
@@ -960,37 +937,30 @@ def model_from_gbxml_cli(gbxml_file, osw_folder, output_file):
|
|
|
960
937
|
sys.exit(0)
|
|
961
938
|
|
|
962
939
|
|
|
963
|
-
def model_from_gbxml(gbxml_file,
|
|
940
|
+
def model_from_gbxml(gbxml_file, reset_properties=False, osw_folder=None,
|
|
941
|
+
output_file=None, keep_properties=True):
|
|
964
942
|
"""Translate a gbXML to a Honeybee Model (HBJSON).
|
|
965
943
|
|
|
966
944
|
Args:
|
|
967
945
|
gbxml_file: Path to a gbXML file.
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
the
|
|
946
|
+
reset_properties: Boolean to note whether all energy properties should be
|
|
947
|
+
reset to defaults upon import, meaning that only the geometry and boundary
|
|
948
|
+
conditions are imported from the gbXML Model. (Default: False).
|
|
949
|
+
osw_folder: Deprecated input that is no longer used.
|
|
971
950
|
output_file: Optional HBJSON file to output the string of the translation.
|
|
972
951
|
If None, it will be returned from this method. (Default: None).
|
|
973
952
|
"""
|
|
974
|
-
#
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
#
|
|
984
|
-
|
|
985
|
-
osw = from_gbxml_osw(gbxml_file, out_f, osw_folder)
|
|
986
|
-
file_contents = _run_translation_osw(osw, out_path)
|
|
987
|
-
|
|
988
|
-
# return the file contents if requested
|
|
989
|
-
if file_contents is not None:
|
|
990
|
-
if output_file is None:
|
|
991
|
-
return file_contents
|
|
992
|
-
else:
|
|
993
|
-
print(file_contents)
|
|
953
|
+
# check that honeybee-openstudio is installed
|
|
954
|
+
try:
|
|
955
|
+
from honeybee_openstudio.reader import model_from_gbxml_file
|
|
956
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
957
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
958
|
+
if osw_folder is not None:
|
|
959
|
+
print('--folder is deprecated and no longer used.')
|
|
960
|
+
# translate everything to a honeybee Model
|
|
961
|
+
model = model_from_gbxml_file(gbxml_file, reset_properties)
|
|
962
|
+
# write out the file
|
|
963
|
+
return process_content_to_output(json.dumps(model.to_dict()), output_file)
|
|
994
964
|
|
|
995
965
|
|
|
996
966
|
@translate.command('constructions-to-idf')
|
|
@@ -1088,9 +1058,8 @@ def construction_from_idf(construction_idf, indent, output_file):
|
|
|
1088
1058
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1089
1059
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1090
1060
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1091
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1092
|
-
|
|
1093
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1061
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1062
|
+
default=None,
|
|
1094
1063
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1095
1064
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1096
1065
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1106,12 +1075,18 @@ def materials_from_osm(osm_file, indent, osw_folder, output_file):
|
|
|
1106
1075
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1107
1076
|
"""
|
|
1108
1077
|
try:
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1078
|
+
try:
|
|
1079
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1080
|
+
from honeybee_openstudio.material import extract_all_materials
|
|
1081
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1082
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1083
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1084
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1085
|
+
if not os_model.is_initialized():
|
|
1086
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1087
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1088
|
+
materials = extract_all_materials(os_model.get())
|
|
1089
|
+
out_dict = {mat.identifier: mat.to_dict() for mat in materials.values()}
|
|
1115
1090
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1116
1091
|
except Exception as e:
|
|
1117
1092
|
_logger.exception('Material translation failed.\n{}'.format(e))
|
|
@@ -1132,9 +1107,8 @@ def materials_from_osm(osm_file, indent, osw_folder, output_file):
|
|
|
1132
1107
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1133
1108
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1134
1109
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1135
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1136
|
-
|
|
1137
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1110
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1111
|
+
default=None,
|
|
1138
1112
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1139
1113
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1140
1114
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1150,21 +1124,24 @@ def constructions_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1150
1124
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1151
1125
|
"""
|
|
1152
1126
|
try:
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1127
|
+
try:
|
|
1128
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1129
|
+
from honeybee_openstudio.construction import extract_all_constructions
|
|
1130
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1131
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1132
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1133
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1134
|
+
if not os_model.is_initialized():
|
|
1135
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1136
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1137
|
+
constructions = extract_all_constructions(os_model.get())
|
|
1138
|
+
abridged = not full
|
|
1156
1139
|
out_dict = {}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
out_dict[con
|
|
1160
|
-
|
|
1161
|
-
else: # rebuild the full objects to write them as full
|
|
1162
|
-
_, constructions, _, _, _, _, _, _ = \
|
|
1163
|
-
ModelEnergyProperties.load_properties_from_dict(
|
|
1164
|
-
model_dict, skip_invalid=True)
|
|
1165
|
-
for con in constructions.values():
|
|
1140
|
+
for con in constructions.values():
|
|
1141
|
+
try:
|
|
1142
|
+
out_dict[con.identifier] = con.to_dict(abridged=abridged)
|
|
1143
|
+
except TypeError: # no abridged option
|
|
1166
1144
|
out_dict[con.identifier] = con.to_dict()
|
|
1167
|
-
# write the resulting JSON
|
|
1168
1145
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1169
1146
|
except Exception as e:
|
|
1170
1147
|
_logger.exception('Construction translation failed.\n{}'.format(e))
|
|
@@ -1185,9 +1162,8 @@ def constructions_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1185
1162
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1186
1163
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1187
1164
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1188
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1189
|
-
|
|
1190
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1165
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1166
|
+
default=None,
|
|
1191
1167
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1192
1168
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1193
1169
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1203,21 +1179,25 @@ def construction_sets_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1203
1179
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1204
1180
|
"""
|
|
1205
1181
|
try:
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1182
|
+
try:
|
|
1183
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1184
|
+
from honeybee_openstudio.construction import extract_all_constructions
|
|
1185
|
+
from honeybee_openstudio.constructionset import construction_set_from_openstudio
|
|
1186
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1187
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1188
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1189
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1190
|
+
if not os_model.is_initialized():
|
|
1191
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1192
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1193
|
+
os_model = os_model.get()
|
|
1194
|
+
constructions = extract_all_constructions(os_model)
|
|
1195
|
+
abridged = not full
|
|
1209
1196
|
out_dict = {}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
else: # rebuild the full objects to write them as full
|
|
1215
|
-
_, _, construction_sets, _, _, _, _, _ = \
|
|
1216
|
-
ModelEnergyProperties.load_properties_from_dict(
|
|
1217
|
-
model_dict, skip_invalid=True)
|
|
1218
|
-
for c_set in construction_sets.values():
|
|
1219
|
-
out_dict[c_set.identifier] = c_set.to_dict()
|
|
1220
|
-
# write the resulting JSON
|
|
1197
|
+
for os_cons_set in os_model.getDefaultConstructionSets():
|
|
1198
|
+
if os_cons_set.nameString() != 'Default Generic Construction Set':
|
|
1199
|
+
con_set = construction_set_from_openstudio(os_cons_set, constructions)
|
|
1200
|
+
out_dict[con_set.identifier] = con_set.to_dict(abridged=abridged)
|
|
1221
1201
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1222
1202
|
except Exception as e:
|
|
1223
1203
|
_logger.exception('ConstructionSet translation failed.\n{}'.format(e))
|
|
@@ -1327,9 +1307,8 @@ def schedule_from_idf(schedule_idf, indent, output_file):
|
|
|
1327
1307
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1328
1308
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1329
1309
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1330
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1331
|
-
|
|
1332
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1310
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1311
|
+
default=None,
|
|
1333
1312
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1334
1313
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1335
1314
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1345,12 +1324,20 @@ def schedule_type_limits_from_osm(osm_file, indent, osw_folder, output_file):
|
|
|
1345
1324
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1346
1325
|
"""
|
|
1347
1326
|
try:
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1327
|
+
try:
|
|
1328
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1329
|
+
from honeybee_openstudio.schedule import schedule_type_limits_from_openstudio
|
|
1330
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1331
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1332
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1333
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1334
|
+
if not os_model.is_initialized():
|
|
1335
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1336
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1351
1337
|
out_dict = {}
|
|
1352
|
-
for
|
|
1353
|
-
|
|
1338
|
+
for os_type_lim in os_model.get().getScheduleTypeLimitss():
|
|
1339
|
+
type_lim = schedule_type_limits_from_openstudio(os_type_lim)
|
|
1340
|
+
out_dict[type_lim.identifier] = type_lim.to_dict()
|
|
1354
1341
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1355
1342
|
except Exception as e:
|
|
1356
1343
|
_logger.exception('ScheduleTypeLimit translation failed.\n{}'.format(e))
|
|
@@ -1371,9 +1358,8 @@ def schedule_type_limits_from_osm(osm_file, indent, osw_folder, output_file):
|
|
|
1371
1358
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1372
1359
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1373
1360
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1374
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1375
|
-
|
|
1376
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1361
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1362
|
+
default=None,
|
|
1377
1363
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1378
1364
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1379
1365
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1389,21 +1375,21 @@ def schedules_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1389
1375
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1390
1376
|
"""
|
|
1391
1377
|
try:
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1378
|
+
try:
|
|
1379
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1380
|
+
from honeybee_openstudio.schedule import extract_all_schedules
|
|
1381
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1382
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1383
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1384
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1385
|
+
if not os_model.is_initialized():
|
|
1386
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1387
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1388
|
+
schedules = extract_all_schedules(os_model.get())
|
|
1389
|
+
abridged = not full
|
|
1395
1390
|
out_dict = {}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
out_dict[sch['identifier']] = sch
|
|
1399
|
-
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1400
|
-
else: # rebuild the full objects to write them as full
|
|
1401
|
-
_, _, _, _, schedules, _, _, _ = \
|
|
1402
|
-
ModelEnergyProperties.load_properties_from_dict(
|
|
1403
|
-
model_dict, skip_invalid=True)
|
|
1404
|
-
for sch in schedules.values():
|
|
1405
|
-
out_dict[sch.identifier] = sch.to_dict()
|
|
1406
|
-
# write the resulting JSON
|
|
1391
|
+
for sch in schedules.values():
|
|
1392
|
+
out_dict[sch.identifier] = sch.to_dict(abridged=abridged)
|
|
1407
1393
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1408
1394
|
except Exception as e:
|
|
1409
1395
|
_logger.exception('Schedule translation failed.\n{}'.format(e))
|
|
@@ -1424,9 +1410,8 @@ def schedules_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1424
1410
|
@click.option('--indent', '-i', help='Optional integer to specify the indentation in '
|
|
1425
1411
|
'the output JSON file. Specifying an value here can produce more read-able'
|
|
1426
1412
|
' JSONs.', type=int, default=None, show_default=True)
|
|
1427
|
-
@click.option('--osw-folder', '-osw', help='
|
|
1428
|
-
|
|
1429
|
-
'temp folder in the default simulation folder.', default=None,
|
|
1413
|
+
@click.option('--osw-folder', '-osw', help='Deprecated input that is no longer used.',
|
|
1414
|
+
default=None,
|
|
1430
1415
|
type=click.Path(file_okay=False, dir_okay=True, resolve_path=True))
|
|
1431
1416
|
@click.option('--output-file', '-f', help='Optional JSON file to output the string '
|
|
1432
1417
|
'of the translation. By default it printed out to stdout',
|
|
@@ -1442,21 +1427,24 @@ def programs_from_osm(osm_file, full, indent, osw_folder, output_file):
|
|
|
1442
1427
|
osm_file: Path to a OpenStudio Model (OSM) file.
|
|
1443
1428
|
"""
|
|
1444
1429
|
try:
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1430
|
+
try:
|
|
1431
|
+
from honeybee_openstudio.openstudio import openstudio
|
|
1432
|
+
from honeybee_openstudio.schedule import extract_all_schedules
|
|
1433
|
+
from honeybee_openstudio.programtype import program_type_from_openstudio
|
|
1434
|
+
except ImportError as e: # honeybee-openstudio is not installed
|
|
1435
|
+
raise ImportError('{}\n{}'.format(HB_OS_MSG, e))
|
|
1436
|
+
ver_translator = openstudio.osversion.VersionTranslator() # in case OSM is old
|
|
1437
|
+
os_model = ver_translator.loadModel(osm_file)
|
|
1438
|
+
if not os_model.is_initialized():
|
|
1439
|
+
errors = '\n'.join(str(err.logMessage()) for err in ver_translator.errors())
|
|
1440
|
+
raise ValueError('Failed to load model from OSM.\n{}'.format(errors))
|
|
1441
|
+
os_model = os_model.get()
|
|
1442
|
+
schedules = extract_all_schedules(os_model)
|
|
1443
|
+
abridged = not full
|
|
1448
1444
|
out_dict = {}
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1453
|
-
else: # rebuild the full objects to write them as full
|
|
1454
|
-
_, _, _, _, _, program_types, _, _ = \
|
|
1455
|
-
ModelEnergyProperties.load_properties_from_dict(
|
|
1456
|
-
model_dict, skip_invalid=True)
|
|
1457
|
-
for prog in program_types.values():
|
|
1458
|
-
out_dict[prog.identifier] = prog.to_dict()
|
|
1459
|
-
# write the resulting JSON
|
|
1445
|
+
for os_space_type in os_model.getSpaceTypes():
|
|
1446
|
+
program = program_type_from_openstudio(os_space_type, schedules)
|
|
1447
|
+
out_dict[program.identifier] = program.to_dict(abridged=abridged)
|
|
1460
1448
|
output_file.write(json.dumps(out_dict, indent=indent))
|
|
1461
1449
|
except Exception as e:
|
|
1462
1450
|
_logger.exception('Program translation failed.\n{}'.format(e))
|
|
@@ -34,7 +34,7 @@ honeybee_energy/cli/result.py,sha256=Cqg1KwkDqeqLjpBn8dpWXvHqg_UyxNmLTgj64gfpBWY
|
|
|
34
34
|
honeybee_energy/cli/setconfig.py,sha256=c22bvTyCH1ieebkP39-YI2uI3irjVjGOL90ysrRdgmg,4386
|
|
35
35
|
honeybee_energy/cli/settings.py,sha256=gDPQDN1XmYiIxEag9aYboWoifrCcD2AYOEw3M_b8_v4,28731
|
|
36
36
|
honeybee_energy/cli/simulate.py,sha256=5i5_O8m_iXHXukr53TVyqfNmwZSUqgNiLB8K9EbNjLA,18589
|
|
37
|
-
honeybee_energy/cli/translate.py,sha256=
|
|
37
|
+
honeybee_energy/cli/translate.py,sha256=0NjQdyP_FoyVE7AWwV6aIpv-3iGMorF6ODuG7EhabBg,81377
|
|
38
38
|
honeybee_energy/cli/validate.py,sha256=viXYu6Xx_LOdDK2NUqpwIr6QyWd5_AGgKZTCYUmpaoA,9339
|
|
39
39
|
honeybee_energy/construction/__init__.py,sha256=oCfbVLV3m_Imqf8JK0_IyVdKuMJphPQOCQ5_MjcH9Us,37
|
|
40
40
|
honeybee_energy/construction/_base.py,sha256=s-ha1K2FsbZELYZEqcBBjgkFnA9Ik-LxCnFsDVUsSVc,14321
|
|
@@ -42,7 +42,7 @@ honeybee_energy/construction/air.py,sha256=6_fcd8FLFgBmo6jKMB6cvDF-MIuBsI6uO7VW9
|
|
|
42
42
|
honeybee_energy/construction/dictutil.py,sha256=k8-e6_5W0yOxO9CY95Ww5IA7jqpic9EbbTE3pCP7Bw0,4334
|
|
43
43
|
honeybee_energy/construction/dynamic.py,sha256=tKzEOuIdUCGxGjpRJaBfjMIz6Q3d5h5i675SJyTJ3J4,23395
|
|
44
44
|
honeybee_energy/construction/opaque.py,sha256=HwmWXIdK33Li8bN61QlvxsZBecJVuSqSzVrS6pOwY_w,20228
|
|
45
|
-
honeybee_energy/construction/shade.py,sha256=
|
|
45
|
+
honeybee_energy/construction/shade.py,sha256=OV712l0RIcOYbKTnlZ0mUnM1XvL70vuvtm7yp5vD1a8,12358
|
|
46
46
|
honeybee_energy/construction/window.py,sha256=ZMVby9ejWVDGGR60YKsqctjdG_DyPn4ezfKdTGVEtFo,50253
|
|
47
47
|
honeybee_energy/construction/windowshade.py,sha256=FfiI7O8PaA1oqA5Nc23IiRR6FuffE-5WxclzSnwsQ0c,35384
|
|
48
48
|
honeybee_energy/generator/__init__.py,sha256=oP95uJfNAf5t6HxnQhKZPhNd3MthO4VzpoTq2Q_OAgE,164
|
|
@@ -156,9 +156,9 @@ honeybee_energy/ventcool/opening.py,sha256=ZywoADlNQ6_8OfjV71ZUpbCAetQrRVj7aprBj
|
|
|
156
156
|
honeybee_energy/ventcool/simulation.py,sha256=gMF4sgCQ5R4iFWPnvvB3wxgeP_zEwnWl71ObIIe4XGU,14423
|
|
157
157
|
tests/fixtures/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
158
158
|
tests/fixtures/userdata_fixtures.py,sha256=yDvBR6nsltel_U8hUoUsJ6yufPKTR7Wnsgxe68HtswQ,313
|
|
159
|
-
honeybee_energy-1.116.
|
|
160
|
-
honeybee_energy-1.116.
|
|
161
|
-
honeybee_energy-1.116.
|
|
162
|
-
honeybee_energy-1.116.
|
|
163
|
-
honeybee_energy-1.116.
|
|
164
|
-
honeybee_energy-1.116.
|
|
159
|
+
honeybee_energy-1.116.14.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
160
|
+
honeybee_energy-1.116.14.dist-info/METADATA,sha256=SEcr8XfiJUKWLSgTm_VPF5Toy58f5VpavpOBmnZLiUI,3563
|
|
161
|
+
honeybee_energy-1.116.14.dist-info/WHEEL,sha256=AHX6tWk3qWuce7vKLrj7lnulVHEdWoltgauo8bgCXgU,109
|
|
162
|
+
honeybee_energy-1.116.14.dist-info/entry_points.txt,sha256=QOMJbH-StaxT4hCjskZtqetNCMNioP3ZiuhoLQ6MANc,63
|
|
163
|
+
honeybee_energy-1.116.14.dist-info/top_level.txt,sha256=V9Lz0281hfT83Fy0fSdn_6vwRK9vTQe1_LQXd0_-gAI,22
|
|
164
|
+
honeybee_energy-1.116.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|