honeybee-openstudio 2.28.0 → 2.28.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: 68d5909ca4defd67e4437a988537724db7f6b1ae5691342278eb0c13c47cc033
4
- data.tar.gz: ada6cbf89e0813172a16b4ffb1ac7fa78a26c6018e4b5a439586d886816a55e4
3
+ metadata.gz: f46d6897c585ff7082971de6ff24b62e1d4213697bb9e3fb08a9b4eefd069a6d
4
+ data.tar.gz: 4c231dc4b6622e5d9871eddb54e6b6e32ebb5302183372845ea690552f0407f3
5
5
  SHA512:
6
- metadata.gz: 5e0eee873af2b06907cfed7ca2124d27ab9396f0d43eb8b1cf7895910d4645bd26b3dd84357f6954bfa85502fa4b61332fd7d2e2171d33a5a3797ede14e3ef3e
7
- data.tar.gz: 1a784987d9db719a4cb703f2e47041f2612003fa3b1595a5c6bf017a2f895d9edbf494462cfd0141c9783f929a3c3450fd691f7457882427642acef706a9f528
6
+ metadata.gz: 8a9192fca6bf36375576eb5fd7efb3f104e4ed34b2607e8d80c36ce60f272cdd7c62b1badb4a43f1c0daa0e813b63e5dffc407e25032172c045d7523b5f05e7d
7
+ data.tar.gz: e2533183332b489d8ba275feddf184c56f7cdca3a5bb561ce9ae7ad6af3177b9983b57872a1623c316a1d4b3ddea060dec1ab2714429edbe1a450928c5a5bb01
@@ -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.28.0'
7
+ spec.version = '2.28.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
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'ShadeConstruction'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = clean_name(construction.nameString)
43
+ hash[:identifier] = clean_name(construction.nameString) + ' Shade'
44
44
  unless construction.displayName.empty?
45
45
  hash[:display_name] = (construction.displayName.get).force_encoding("UTF-8")
46
46
  end
@@ -72,7 +72,7 @@ module Honeybee
72
72
  unless sub_surface.isConstructionDefaulted
73
73
  construction = sub_surface.construction
74
74
  if !construction.empty?
75
- constr_id = clean_identifier(construction.get.nameString)
75
+ constr_id = clean_name(construction.get.nameString)
76
76
  unless $window_constructions[constr_id].nil?
77
77
  hash[:construction] = constr_id
78
78
  end
@@ -72,7 +72,7 @@ module Honeybee
72
72
  unless sub_surface.isConstructionDefaulted
73
73
  construction = sub_surface.construction
74
74
  if !construction.empty?
75
- constr_id = clean_identifier(construction.get.nameString)
75
+ constr_id = clean_name(construction.get.nameString)
76
76
  if hash[:is_glass] && !$window_constructions[constr_id].nil?
77
77
  hash[:construction] = constr_id
78
78
  elsif !hash[:is_glass] && !$opaque_constructions[constr_id].nil?
@@ -74,7 +74,7 @@ module Honeybee
74
74
  unless surface.isConstructionDefaulted
75
75
  construction = surface.construction
76
76
  if !construction.empty?
77
- constr_id = clean_identifier(construction.get.nameString)
77
+ constr_id = clean_name(construction.get.nameString)
78
78
  unless $opaque_constructions[constr_id].nil?
79
79
  hash[:construction] = constr_id
80
80
  end
@@ -62,7 +62,7 @@ module Honeybee
62
62
  unless shading_surface.isConstructionDefaulted
63
63
  construction = shading_surface.construction
64
64
  if !construction.empty?
65
- const_name = clean_identifier(construction.get.nameString)
65
+ const_name = clean_name(construction.get.nameString) + ' Shade'
66
66
  hash[:construction] = const_name
67
67
  unless $shade_constructions.has_key?(const_name)
68
68
  const_obj = construction.get
@@ -74,7 +74,7 @@ module Honeybee
74
74
 
75
75
  transmittance_schedule = shading_surface.transmittanceSchedule
76
76
  if !transmittance_schedule.empty?
77
- trans_sch_name = clean_identifier(transmittance_schedule.get.nameString)
77
+ trans_sch_name = clean_name(transmittance_schedule.get.nameString)
78
78
  # Check whether schedules other than schedule ruleset or schedule fixed interval are
79
79
  # being assigned
80
80
  unless $schedules[trans_sch_name].nil?
@@ -160,5 +160,50 @@ module Honeybee
160
160
 
161
161
  return result
162
162
  end
163
+
164
+ def to_openstudio_shade(openstudio_model, shading_surface_group)
165
+ # get the vertices from the aperture
166
+ if @hash[:geometry][:vertices].nil?
167
+ hb_verts = @hash[:geometry][:boundary]
168
+ else
169
+ hb_verts = @hash[:geometry][:vertices]
170
+ end
171
+
172
+ # create the openstudio shading surface
173
+ os_vertices = OpenStudio::Point3dVector.new
174
+ hb_verts.each do |vertex|
175
+ os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
176
+ end
177
+ reordered_vertices = OpenStudio.reorderULC(os_vertices)
178
+
179
+ os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
180
+ os_shading_surface.setName(@hash[:identifier])
181
+ unless @hash[:display_name].nil?
182
+ os_shading_surface.setDisplayName(@hash[:display_name])
183
+ end
184
+
185
+ # get the approriate construction id
186
+ construction_id = nil
187
+ if @hash[:properties][:energy][:construction]
188
+ construction_id = @hash[:properties][:energy][:construction]
189
+ else
190
+ construction_id = 'Generic Double Pane'
191
+ end
192
+
193
+ # assign the construction
194
+ unless construction_id.nil?
195
+ construction = openstudio_model.getConstructionByName(construction_id)
196
+ unless construction.empty?
197
+ os_construction = construction.get
198
+ os_shading_surface.setConstruction(os_construction)
199
+ end
200
+ end
201
+
202
+ # add the shade to the group
203
+ os_shading_surface.setShadingSurfaceGroup(shading_surface_group)
204
+
205
+ os_shading_surface
206
+ end
207
+
163
208
  end # Aperture
164
209
  end # Honeybee
@@ -154,4 +154,51 @@ module Honeybee
154
154
  return result
155
155
  end
156
156
  end # Door
157
+
158
+ def to_openstudio_shade(openstudio_model, shading_surface_group)
159
+ # get the vertices from the door
160
+ if @hash[:geometry][:vertices].nil?
161
+ hb_verts = @hash[:geometry][:boundary]
162
+ else
163
+ hb_verts = @hash[:geometry][:vertices]
164
+ end
165
+
166
+ # create the openstudio shading surface
167
+ os_vertices = OpenStudio::Point3dVector.new
168
+ hb_verts.each do |vertex|
169
+ os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
170
+ end
171
+ reordered_vertices = OpenStudio.reorderULC(os_vertices)
172
+
173
+ os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
174
+ os_shading_surface.setName(@hash[:identifier])
175
+ unless @hash[:display_name].nil?
176
+ os_shading_surface.setDisplayName(@hash[:display_name])
177
+ end
178
+
179
+ # get the approriate construction id
180
+ construction_id = nil
181
+ if @hash[:properties][:energy][:construction]
182
+ construction_id = @hash[:properties][:energy][:construction]
183
+ elsif @hash[:is_glass] == true
184
+ construction_id = 'Generic Double Pane'
185
+ else
186
+ construction_id = 'Generic Exterior Door'
187
+ end
188
+
189
+ # assign the construction
190
+ unless construction_id.nil?
191
+ construction = openstudio_model.getConstructionByName(construction_id)
192
+ unless construction.empty?
193
+ os_construction = construction.get
194
+ os_shading_surface.setConstruction(os_construction)
195
+ end
196
+ end
197
+
198
+ # add the shade to the group
199
+ os_shading_surface.setShadingSurfaceGroup(shading_surface_group)
200
+
201
+ os_shading_surface
202
+ end
203
+
157
204
  end # Honeybee
@@ -184,5 +184,70 @@ module Honeybee
184
184
 
185
185
  os_surface
186
186
  end
187
+
188
+ def to_openstudio_shade(openstudio_model, shading_surface_group)
189
+ # get the vertices from the face
190
+ if @hash[:geometry][:vertices].nil?
191
+ hb_verts = @hash[:geometry][:boundary]
192
+ else
193
+ hb_verts = @hash[:geometry][:vertices]
194
+ end
195
+
196
+ # create the openstudio shading surface
197
+ os_vertices = OpenStudio::Point3dVector.new
198
+ hb_verts.each do |vertex|
199
+ os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
200
+ end
201
+ reordered_vertices = OpenStudio.reorderULC(os_vertices)
202
+
203
+ os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
204
+ os_shading_surface.setName(@hash[:identifier])
205
+ unless @hash[:display_name].nil?
206
+ os_shading_surface.setDisplayName(@hash[:display_name])
207
+ end
208
+
209
+ # get the approriate construction id
210
+ construction_id = nil
211
+ if @hash[:properties][:energy][:construction]
212
+ construction_id = @hash[:properties][:energy][:construction]
213
+ elsif @hash[:face_type] == 'Wall'
214
+ construction_id = 'Generic Exterior Wall'
215
+ elsif @hash[:face_type] == 'RoofCeiling'
216
+ construction_id = 'Generic Roof'
217
+ elsif @hash[:face_type] == 'Floor'
218
+ construction_id = 'Generic Exposed Floor'
219
+ end
220
+
221
+ # assign the construction
222
+ unless construction_id.nil?
223
+ construction = openstudio_model.getConstructionByName(construction_id)
224
+ unless construction.empty?
225
+ os_construction = construction.get
226
+ os_shading_surface.setConstruction(os_construction)
227
+ end
228
+ end
229
+
230
+ # add the shade to the group
231
+ os_shading_surface.setShadingSurfaceGroup(shading_surface_group)
232
+
233
+ # convert the apertures to shade objects
234
+ if @hash[:apertures]
235
+ @hash[:apertures].each do |aperture|
236
+ hb_aperture = Aperture.new(aperture)
237
+ os_subsurface_aperture = hb_aperture.to_openstudio_shade(openstudio_model, shading_surface_group)
238
+ end
239
+ end
240
+
241
+ # convert the apertures to shade objects
242
+ if @hash[:doors]
243
+ @hash[:doors].each do |door|
244
+ hb_door = Door.new(door)
245
+ os_subsurface_door = hb_door.to_openstudio_shade(openstudio_model, shading_surface_group)
246
+ end
247
+ end
248
+
249
+ os_shading_surface
250
+ end
251
+
187
252
  end # Face
188
253
  end # Honeybee
@@ -203,6 +203,9 @@ module Honeybee
203
203
  puts 'Translating Context Shade Geometry'
204
204
  end
205
205
  create_orphaned_shades
206
+ create_orphaned_faces
207
+ create_orphaned_apertures
208
+ create_orphaned_doors
206
209
  end
207
210
 
208
211
  def create_materials(material_dicts, check_existing=false)
@@ -588,28 +591,43 @@ module Honeybee
588
591
  shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
589
592
  shading_surface_group.setShadingSurfaceType('Building')
590
593
  @hash[:orphaned_shades].each do |shade|
591
- shade_object = Shade.new(shade)
592
- openstudio_shade = shade_object.to_openstudio(@openstudio_model)
593
- openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
594
+ shade_object = Shade.new(shade)
595
+ openstudio_shade = shade_object.to_openstudio(@openstudio_model)
596
+ openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
594
597
  end
595
598
  end
596
599
  end
597
600
 
598
601
  def create_orphaned_faces
599
602
  if @hash[:orphaned_faces]
600
- raise "Orphaned Faces are not translatable to OpenStudio."
603
+ shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
604
+ shading_surface_group.setShadingSurfaceType('Building')
605
+ @hash[:orphaned_faces].each do |face|
606
+ face_object = Face.new(face)
607
+ openstudio_shade = face_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
608
+ end
601
609
  end
602
610
  end
603
611
 
604
612
  def create_orphaned_apertures
605
613
  if @hash[:orphaned_apertures]
606
- raise "Orphaned Apertures are not translatable to OpenStudio."
614
+ shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
615
+ shading_surface_group.setShadingSurfaceType('Building')
616
+ @hash[:orphaned_apertures].each do |ap|
617
+ ap_object = Aperture.new(ap)
618
+ openstudio_shade = ap_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
619
+ end
607
620
  end
608
621
  end
609
622
 
610
623
  def create_orphaned_doors
611
624
  if @hash[:orphaned_doors]
612
- raise "Orphaned Doors are not translatable to OpenStudio."
625
+ shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
626
+ shading_surface_group.setShadingSurfaceType('Building')
627
+ @hash[:orphaned_doors].each do |dr|
628
+ dr_object = Door.new(dr)
629
+ openstudio_shade = dr_object.to_openstudio_shade(@openstudio_model, shading_surface_group)
630
+ end
613
631
  end
614
632
  end
615
633
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybee-openstudio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.28.0
4
+ version: 2.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-12-02 00:00:00.000000000 Z
14
+ date: 2021-12-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler