honeybee-openstudio 2.17.2 → 2.18.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 401f4b381eccac914b26b4b495cb68404b9f05a65cbeac664811daf45f553e67
4
- data.tar.gz: 5941ca144302633ce06fad80d5180df0a4d76dff593b1c8247893f9672476854
3
+ metadata.gz: 360f33826c9c5ac0030753392e25e8c49b9be52b68ec03da684fd20503c3e1f8
4
+ data.tar.gz: b8d57eab2e20d6dcb19220dcca07091ffc768bd1686fa6f156a013fa5470b863
5
5
  SHA512:
6
- metadata.gz: f14e02b1f1e390ba91b4b18ab5d8e117c37a86d5ddaf5505bc1b1ae7e3c6fe47cb709d5922761cafc5b8fa73a5b30379d96111d0c092597f8e6dc6af3a0c3d5c
7
- data.tar.gz: f10ea540a04922dacd425de54ee4ee9ac303543d57255b693ecd13802e1f08e4ea4d321ab1d8a69287cb93e03d0b4aa2ea57fe6046f281f4b0ca9e1beac31a6e
6
+ metadata.gz: 39d194113026357c05405ee505e7f4b39711fd6cf45536195aa515fff2a7cc6dbfb22592fac28fb6c359c5e1458573697723377348be1bf90034fbf7df7262cc
7
+ data.tar.gz: 95fcfdd2b144d870cebbe2e88bf2a3a139b9ae93c9fa2c0906eee93870e4d280472639ecaf19fcbd8188d09af5866e62f9f8c9f34e84717439b0fcce95a70d5a
data/README.md CHANGED
@@ -7,7 +7,6 @@
7
7
 
8
8
  Library and measures for translating between Honeybee JSON schema and OpenStudio Model schema (OSM).
9
9
 
10
-
11
10
  ## Run the measures of this repo using OpenStudio CLI
12
11
 
13
12
  Running the measures using OpenStudio CLI requires no installation other than cloning
@@ -42,8 +41,8 @@ where the items in parentheses should be replaced with specific file paths:
42
41
 
43
42
  ```
44
43
 
45
-
46
44
  ## Local Development
45
+
47
46
  1. Clone this repo locally
48
47
  ```
49
48
  git clone git@github.com:ladybug-tools/honeybee-openstudio-gem
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'honeybee-openstudio'
7
- spec.version = '2.17.2'
7
+ spec.version = '2.18.1'
8
8
  spec.authors = ['Tanushree Charan', 'Dan Macumber', 'Chris Mackey', 'Mostapha Sadeghipour Roudsari']
9
9
  spec.email = ['tanushree.charan@nrel.gov', 'chris@ladybug.tools']
10
10
 
@@ -43,6 +43,22 @@ require 'from_openstudio/geometry/face'
43
43
  require 'from_openstudio/geometry/room'
44
44
  require 'from_openstudio/geometry/shade'
45
45
 
46
+ # extend the construction objects
47
+ require 'from_openstudio/construction/opaque'
48
+ require 'from_openstudio/construction/window'
49
+ require 'from_openstudio/construction/shade'
50
+ require 'from_openstudio/construction/air'
51
+
52
+ # import the material objects
53
+ require 'from_openstudio/material/opaque'
54
+ require 'from_openstudio/material/opaque_no_mass'
55
+ require 'from_openstudio/material/window_gas'
56
+ require 'from_openstudio/material/window_gas_mixture'
57
+ require 'from_openstudio/material/window_gas_custom'
58
+ require 'from_openstudio/material/window_blind'
59
+ require 'from_openstudio/material/window_glazing'
60
+ require 'from_openstudio/material/window_simpleglazsys'
61
+
46
62
  # extend the simulation objects
47
63
  require 'from_openstudio/simulation/design_day'
48
64
  require 'from_openstudio/simulation/parameter_model'
@@ -0,0 +1,55 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'honeybee/construction/air'
33
+ require 'to_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class AirBoundaryConstructionAbridged < ModelObject
37
+
38
+ def self.from_construction(construction)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'AirBoundaryConstructionAbridged'
42
+ # set hash values from OpenStudio Object
43
+ hash[:identifier] = construction.nameString
44
+ # check if boost optional object is empty
45
+ unless construction.simpleMixingSchedule.empty?
46
+ schedule = construction.simpleMixingSchedule.get
47
+ hash[:air_mixing_schedule] = schedule.nameString
48
+ end
49
+ #TODO: Add air_mixing_per_area
50
+
51
+ hash
52
+ end
53
+
54
+ end # AirBoundaryConstructionAbridged
55
+ end # Honeybee
@@ -0,0 +1,56 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'honeybee/construction/opaque'
33
+ require 'to_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class OpaqueConstructionAbridged < ModelObject
37
+
38
+ def self.from_construction(construction)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'OpaqueConstructionAbridged'
42
+ # set hash values from OpenStudio Object
43
+ hash[:identifier] = construction.nameString
44
+ hash[:materials] = []
45
+ # get construction layers
46
+ layers = construction.layers
47
+ layers.each do |layer|
48
+ name = layer.nameString
49
+ hash[:materials] << name
50
+ end
51
+
52
+ hash
53
+ end
54
+
55
+ end # OpaqueConstructionAbridged
56
+ end # Honeybee
@@ -0,0 +1,82 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'honeybee/construction/shade'
33
+ require 'from_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class ShadeConstruction < ModelObject
37
+
38
+ def self.from_construction(construction)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'ShadeConstruction'
42
+ # set hash values from OpenStudio Object
43
+ hash[:identifier] = construction.nameString
44
+ # get outermost construction layers
45
+ layer = construction.layers[0]
46
+ if layer.to_StandardGlazing.is_initialized
47
+ layer = layer.to_StandardGlazing.get
48
+ hash[:is_specular] = true
49
+ # set reflectance properties from outermost layer
50
+ unless layer.frontSideSolarReflectanceatNormalIncidence.empty?
51
+ hash[:solar_reflectance] = layer.frontSideSolarReflectanceatNormalIncidence.get
52
+ end
53
+ unless layer.frontSideVisibleReflectanceatNormalIncidence.empty?
54
+ hash[:visible_reflectance] = layer.frontSideVisibleReflectanceatNormalIncidence.get
55
+ end
56
+ elsif layer.to_StandardOpaqueMaterial.is_initialized
57
+ layer = layer.to_StandardOpaqueMaterial.get
58
+ hash[:is_specular] = false
59
+ # set reflectance properties from outermost layer
60
+ unless layer.solarReflectance.empty?
61
+ hash[:solar_reflectance] = layer.solarReflectance.get
62
+ end
63
+ unless layer.visibleReflectance.empty?
64
+ hash[:visible_reflectance] = layer.visibleReflectance
65
+ end
66
+ elsif layer.to_MasslessOpaqueMaterial.is_initialized
67
+ layer = layer.to_MasslessOpaqueMaterial.get
68
+ hash[:is_specular] = false
69
+ # set reflectance properties from outermost layer
70
+ unless layer.solarAbsorptance.empty?
71
+ hash[:solar_reflectance] = 1 - layer.solarAbsorptance.get
72
+ end
73
+ unless layer.visibleAbsorptance.empty?
74
+ hash[:visible_reflectance] = 1 - layer.visibleAbsorptance.get
75
+ end
76
+ end
77
+
78
+ hash
79
+ end
80
+
81
+ end # ShadeConstruction
82
+ end # Honeybee
@@ -0,0 +1,56 @@
1
+ # *******************************************************************************
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
+ # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # (1) Redistributions of source code must retain the above copyright notice,
9
+ # this list of conditions and the following disclaimer.
10
+ #
11
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
12
+ # this list of conditions and the following disclaimer in the documentation
13
+ # and/or other materials provided with the distribution.
14
+ #
15
+ # (3) Neither the name of the copyright holder nor the names of any contributors
16
+ # may be used to endorse or promote products derived from this software without
17
+ # specific prior written permission from the respective party.
18
+ #
19
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
20
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
23
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
24
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+ # *******************************************************************************
31
+
32
+ require 'honeybee/construction/window'
33
+ require 'to_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class WindowConstructionAbridged
37
+
38
+ def self.from_construction(construction)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'WindowConstructionAbridged'
42
+ # set hash values from OpenStudio Object
43
+ hash[:identifier] = construction.nameString
44
+ hash[:materials] = []
45
+ # get construction layers
46
+ layers = construction.layers
47
+ layers.each do |layer|
48
+ name = layer.nameString
49
+ hash[:materials] << name
50
+ end
51
+
52
+ hash
53
+ end
54
+
55
+ end # WindowConstructionAbridged
56
+ end # Honeybee
@@ -71,7 +71,10 @@ module Honeybee
71
71
 
72
72
  construction = sub_surface.construction
73
73
  if !construction.empty?
74
- hash[:construction] = construction.get.nameString
74
+ constr_id = construction.get.nameString
75
+ unless $window_constructions[constr_id].nil?
76
+ hash[:construction] = constr_id
77
+ end
75
78
  end
76
79
 
77
80
  hash
@@ -71,7 +71,12 @@ module Honeybee
71
71
 
72
72
  construction = sub_surface.construction
73
73
  if !construction.empty?
74
- hash[:construction] = construction.get.nameString
74
+ constr_id = construction.get.nameString
75
+ if hash[:is_glass] && !$window_constructions[constr_id].nil?
76
+ hash[:construction] = constr_id
77
+ elsif !hash[:is_glass] && !$opaque_constructions[constr_id].nil?
78
+ hash[:construction] = constr_id
79
+ end
75
80
  end
76
81
 
77
82
  hash
@@ -73,7 +73,10 @@ module Honeybee
73
73
 
74
74
  construction = surface.construction
75
75
  if !construction.empty?
76
- hash[:construction] = construction.get.nameString
76
+ constr_id = construction.get.nameString
77
+ unless $opaque_constructions[constr_id].nil?
78
+ hash[:construction] = constr_id
79
+ end
77
80
  end
78
81
 
79
82
  hash
@@ -108,7 +111,7 @@ module Honeybee
108
111
 
109
112
  def self.boundary_condition_from_surface(surface)
110
113
  result = {}
111
- surface_type = surface.surfaceType
114
+ surface_bc = surface.outsideBoundaryCondition
112
115
  adjacent_surface = surface.adjacentSurface
113
116
  if !adjacent_surface.empty?
114
117
  adjacent_space = clean_identifier(adjacent_surface.get.space.get.nameString)
@@ -116,7 +119,7 @@ module Honeybee
116
119
  result = {type: 'Surface', boundary_condition_objects: [adjacent_surface, adjacent_space]}
117
120
  elsif surface.isGroundSurface
118
121
  result = {type: 'Ground'}
119
- elsif surface_type == 'Adiabatic'
122
+ elsif surface_bc == 'Adiabatic'
120
123
  result = {type: 'Adiabatic'}
121
124
  else
122
125
  sun_exposure = (surface.sunExposure == 'SunExposed')
@@ -61,7 +61,13 @@ module Honeybee
61
61
 
62
62
  construction = shading_surface.construction
63
63
  if !construction.empty?
64
- hash[:construction] = construction.get.nameString
64
+ const_name = construction.get.nameString
65
+ hash[:construction] = const_name
66
+ unless $shade_constructions.has_key?(const_name)
67
+ const_obj = construction.get
68
+ const = const_obj.to_LayeredConstruction.get
69
+ $shade_constructions[const_name] = const
70
+ end
65
71
  end
66
72
 
67
73
  transmittance_schedule = shading_surface.transmittanceSchedule
@@ -42,18 +42,23 @@ module Honeybee
42
42
  # set hash values from OpenStudio Object
43
43
  hash[:identifier] = material.nameString
44
44
  hash[:r_value] = material.thermalResistance
45
- hash[:roughness] = material.roughness
46
- # check if boost optional object is empty
47
- unless material.thermalAbsorptance.empty?
48
- hash[:thermal_absorptance] = material.thermalAbsorptance.get
49
- end
50
- # check if boost optional object is empty
51
- unless material.solarAbsorptance.empty?
52
- hash[:solar_absorptance] = material.solarAbsorptance.get
53
- end
54
- # check if boost optional object is empty
55
- unless material.visibleAbsorptance.empty?
56
- hash[:visible_absorptance] = material.visibleAbsorptance.get
45
+
46
+ if material.to_MasslessOpaqueMaterial.is_initialized
47
+ # Roughness is a required property for OS MasslessOpaqueMaterial but isn't a listed
48
+ # property for OS AirGap
49
+ hash[:roughness] = material.roughness
50
+ # check if boost optional object is empty
51
+ unless material.thermalAbsorptance.empty?
52
+ hash[:thermal_absorptance] = material.thermalAbsorptance.get
53
+ end
54
+ # check if boost optional object is empty
55
+ unless material.solarAbsorptance.empty?
56
+ hash[:solar_absorptance] = material.solarAbsorptance.get
57
+ end
58
+ # check if boost optional object is empty
59
+ unless material.visibleAbsorptance.empty?
60
+ hash[:visible_absorptance] = material.visibleAbsorptance.get
61
+ end
57
62
  end
58
63
 
59
64
  hash
@@ -41,6 +41,10 @@ require 'from_openstudio/material/window_blind'
41
41
  require 'from_openstudio/material/window_gas'
42
42
  require 'from_openstudio/material/window_gas_custom'
43
43
  require 'from_openstudio/material/window_gas_mixture'
44
+ require 'from_openstudio/construction/air'
45
+ require 'from_openstudio/construction/opaque'
46
+ require 'from_openstudio/construction/window'
47
+ require 'from_openstudio/construction/shade'
44
48
 
45
49
  require 'openstudio'
46
50
 
@@ -57,6 +61,10 @@ module Honeybee
57
61
  hash[:tolerance] = 0.01
58
62
  hash[:angle_tolerance] = 1.0
59
63
 
64
+ # Hashes for all constructions in the model
65
+ $opaque_constructions = {}
66
+ $window_constructions = {}
67
+ $shade_constructions = {}
60
68
  hash[:properties] = properties_from_model(openstudio_model)
61
69
 
62
70
  rooms = rooms_from_model(openstudio_model)
@@ -65,6 +73,12 @@ module Honeybee
65
73
  orphaned_shades = orphaned_shades_from_model(openstudio_model)
66
74
  hash[:orphaned_shades] = orphaned_shades if !orphaned_shades.empty?
67
75
 
76
+ unless $shade_constructions.empty?
77
+ shade_constructions_from_model($shade_constructions).each do |shade_const|
78
+ hash[:properties][:energy][:constructions] << shade_const
79
+ end
80
+ end
81
+
68
82
  Model.new(hash)
69
83
  end
70
84
 
@@ -81,7 +95,15 @@ module Honeybee
81
95
  translator = OpenStudio::GbXML::GbXMLReverseTranslator.new
82
96
  openstudio_model = translator.loadModel(file)
83
97
  raise "Cannot load gbXML file at '#{}'" if openstudio_model.empty?
84
- self.translate_from_openstudio(openstudio_model.get)
98
+ # remove any shade groups that were translated as spaces
99
+ os_model = openstudio_model.get
100
+ spaces = os_model.getSpaces()
101
+ spaces.each do |space|
102
+ if space.surfaces.length() == 0
103
+ space.remove()
104
+ end
105
+ end
106
+ self.translate_from_openstudio(os_model)
85
107
  end
86
108
 
87
109
  # Create Ladybug Energy Model JSON from IDF file
@@ -95,13 +117,17 @@ module Honeybee
95
117
  def self.properties_from_model(openstudio_model)
96
118
  hash = {}
97
119
  hash[:type] = 'ModelProperties'
120
+ hash[:energy] = energy_properties_from_model(openstudio_model)
98
121
  hash
99
122
  end
100
123
 
101
124
  def self.energy_properties_from_model(openstudio_model)
102
125
  hash = {}
103
126
  hash[:type] = 'ModelEnergyProperties'
104
- hash[:energy] = energy_properties_from_model(openstudio_model)
127
+ hash[:constructions] = []
128
+ hash[:constructions] = constructions_from_model(openstudio_model)
129
+ hash[:materials] = materials_from_model(openstudio_model)
130
+
105
131
  hash
106
132
  end
107
133
 
@@ -137,10 +163,17 @@ module Honeybee
137
163
  openstudio_model.getStandardOpaqueMaterials.each do |material|
138
164
  result << EnergyMaterial.from_material(material)
139
165
  end
140
- # Create HB EnergyMaterialNoMass from OpenStudio Material
166
+
167
+ # Create HB EnergyMaterialNoMass from OpenStudio MasslessOpaque Materials
141
168
  openstudio_model.getMasslessOpaqueMaterials.each do |material|
142
169
  result << EnergyMaterialNoMass.from_material(material)
143
170
  end
171
+
172
+ # Create HB EnergyMaterialNoMass from OpenStudio AirGap materials
173
+ openstudio_model.getAirGaps.each do|material|
174
+ result << EnergyMaterialNoMass.from_material(material)
175
+ end
176
+
144
177
  # Create HB WindowMaterialSimpleGlazSys from OpenStudio Material
145
178
  openstudio_model.getSimpleGlazings.each do |material|
146
179
  result << EnergyWindowMaterialSimpleGlazSys.from_material(material)
@@ -170,5 +203,51 @@ module Honeybee
170
203
  result
171
204
  end
172
205
 
206
+ # Create HB Construction from OpenStudio Materials
207
+ def self.constructions_from_model(openstudio_model)
208
+ result = []
209
+
210
+ # Create HB AirConstruction from OpenStudio Construction
211
+ openstudio_model.getConstructionAirBoundarys.each do |construction|
212
+ result << AirBoundaryConstructionAbridged.from_construction(construction)
213
+ end
214
+
215
+ # Create HB WindowConstruction from OpenStudio Construction
216
+ openstudio_model.getConstructions.each do |construction|
217
+ window_construction = false
218
+ opaque_construction = false
219
+ material = construction.layers[0]
220
+ unless material.nil?
221
+ if material.to_StandardGlazing.is_initialized or material.to_SimpleGlazing.is_initialized
222
+ window_construction = true
223
+ elsif material.to_StandardOpaqueMaterial.is_initialized or material.to_MasslessOpaqueMaterial.is_initialized
224
+ opaque_construction = true
225
+ end
226
+ if window_construction == true
227
+ constr_hash = WindowConstructionAbridged.from_construction(construction)
228
+ $window_constructions[constr_hash[:identifier]] = constr_hash
229
+ result << constr_hash
230
+ end
231
+ if opaque_construction == true
232
+ constr_hash = OpaqueConstructionAbridged.from_construction(construction)
233
+ $opaque_constructions[constr_hash[:identifier]] = constr_hash
234
+ result << constr_hash
235
+ end
236
+ end
237
+ end
238
+
239
+ result
240
+ end
241
+
242
+ def self.shade_constructions_from_model(shade_constructions)
243
+ result = []
244
+
245
+ shade_constructions.each do |key, value|
246
+ result << ShadeConstruction.from_construction(value)
247
+ end
248
+
249
+ result
250
+ end
251
+
173
252
  end # Model
174
253
  end # Honeybee