honeybee-openstudio 2.0.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/README.md +1 -1
- data/honeybee-openstudio.gemspec +1 -1
- data/lib/files/urbanopt_Gemfile +4 -12
- data/lib/from_honeybee.rb +1 -0
- data/lib/from_honeybee/_openapi/model.json +2119 -1313
- data/lib/from_honeybee/_openapi/simulation-parameter.json +202 -61
- data/lib/from_honeybee/construction/window.rb +0 -1
- data/lib/from_honeybee/construction/windowshade.rb +207 -0
- data/lib/from_honeybee/model.rb +73 -36
- data/lib/from_honeybee/schedule/ruleset.rb +13 -9
- data/lib/from_honeybee/simulation/parameter.rb +32 -19
- metadata +3 -2
data/lib/from_honeybee/model.rb
CHANGED
@@ -50,6 +50,7 @@ require 'from_honeybee/hvac/ideal_air'
|
|
50
50
|
# import the construction objects
|
51
51
|
require 'from_honeybee/construction/opaque'
|
52
52
|
require 'from_honeybee/construction/window'
|
53
|
+
require 'from_honeybee/construction/windowshade'
|
53
54
|
require 'from_honeybee/construction/shade'
|
54
55
|
require 'from_honeybee/construction/air'
|
55
56
|
|
@@ -184,12 +185,23 @@ module FromHoneybee
|
|
184
185
|
end
|
185
186
|
create_program_types
|
186
187
|
|
187
|
-
# create all of the model geometry
|
188
188
|
if log_report
|
189
189
|
puts 'Translating Room Geometry'
|
190
190
|
end
|
191
191
|
create_rooms
|
192
192
|
|
193
|
+
unless $window_shade_hash.empty?
|
194
|
+
if log_report
|
195
|
+
puts 'Translating Window Shading Control'
|
196
|
+
end
|
197
|
+
create_shading_control
|
198
|
+
end
|
199
|
+
|
200
|
+
if log_report
|
201
|
+
puts 'Translating HVAC Systems'
|
202
|
+
end
|
203
|
+
create_hvacs
|
204
|
+
|
193
205
|
if log_report
|
194
206
|
puts 'Translating Context Shade Geometry'
|
195
207
|
end
|
@@ -197,15 +209,11 @@ module FromHoneybee
|
|
197
209
|
create_orphaned_faces
|
198
210
|
create_orphaned_apertures
|
199
211
|
create_orphaned_doors
|
200
|
-
|
201
|
-
# create the hvac systems
|
202
|
-
if log_report
|
203
|
-
puts 'Translating HVAC Systems'
|
204
|
-
end
|
205
|
-
create_hvacs
|
206
212
|
end
|
207
213
|
|
208
214
|
def create_materials
|
215
|
+
$gas_gap_hash = Hash.new # hash to track gas gaps in case they are split by shades
|
216
|
+
|
209
217
|
@hash[:properties][:energy][:materials].each do |material|
|
210
218
|
material_type = material[:type]
|
211
219
|
|
@@ -216,8 +224,13 @@ module FromHoneybee
|
|
216
224
|
material_object = EnergyMaterialNoMass.new(material)
|
217
225
|
when 'EnergyWindowMaterialGas'
|
218
226
|
material_object = EnergyWindowMaterialGas.new(material)
|
227
|
+
$gas_gap_hash[material[:identifier]] = material_object
|
228
|
+
when 'EnergyWindowMaterialGasMixture'
|
229
|
+
material_object = EnergyWindowMaterialGasMixture.new(material)
|
230
|
+
$gas_gap_hash[material[:identifier]] = material_object
|
219
231
|
when 'EnergyWindowMaterialGasCustom'
|
220
232
|
material_object = EnergyWindowMaterialGasCustom.new(material)
|
233
|
+
$gas_gap_hash[material[:identifier]] = material_object
|
221
234
|
when 'EnergyWindowMaterialSimpleGlazSys'
|
222
235
|
material_object = EnergyWindowMaterialSimpleGlazSys.new(material)
|
223
236
|
when 'EnergyWindowMaterialBlind'
|
@@ -235,6 +248,7 @@ module FromHoneybee
|
|
235
248
|
|
236
249
|
def create_constructions
|
237
250
|
$air_boundary_hash = Hash.new # hash to track any air boundary constructions
|
251
|
+
$window_shade_hash = Hash.new # hash to track any window constructions with shade
|
238
252
|
|
239
253
|
@hash[:properties][:energy][:constructions].each do |construction|
|
240
254
|
identifier = construction[:identifier]
|
@@ -245,6 +259,9 @@ module FromHoneybee
|
|
245
259
|
construction_object = OpaqueConstructionAbridged.new(construction)
|
246
260
|
when 'WindowConstructionAbridged'
|
247
261
|
construction_object = WindowConstructionAbridged.new(construction)
|
262
|
+
when 'WindowConstructionShadeAbridged'
|
263
|
+
construction_object = WindowConstructionShadeAbridged.new(construction)
|
264
|
+
$window_shade_hash[construction[:identifier]] = construction_object
|
248
265
|
when 'ShadeConstruction'
|
249
266
|
construction_object = ShadeConstruction.new(construction)
|
250
267
|
when 'AirBoundaryConstructionAbridged'
|
@@ -344,7 +361,7 @@ module FromHoneybee
|
|
344
361
|
end
|
345
362
|
end
|
346
363
|
|
347
|
-
#
|
364
|
+
# create mixing objects between Rooms
|
348
365
|
$air_mxing_array.each do |air_mix_props|
|
349
366
|
zone_mixing = OpenStudio::Model::ZoneMixing.new(air_mix_props[0])
|
350
367
|
zone_mixing.setDesignFlowRate(air_mix_props[1])
|
@@ -361,35 +378,25 @@ module FromHoneybee
|
|
361
378
|
end
|
362
379
|
end
|
363
380
|
end
|
364
|
-
|
365
|
-
|
366
|
-
def create_orphaned_shades
|
367
|
-
if @hash[:orphaned_shades]
|
368
|
-
shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
|
369
|
-
shading_surface_group.setShadingSurfaceType('Building')
|
370
|
-
@hash[:orphaned_shades].each do |shade|
|
371
|
-
shade_object = Shade.new(shade)
|
372
|
-
openstudio_shade = shade_object.to_openstudio(@openstudio_model)
|
373
|
-
openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
|
374
|
-
end
|
375
|
-
end
|
376
|
-
end
|
377
381
|
|
378
|
-
def
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
382
|
+
def create_shading_control
|
383
|
+
# assign any shading control objects to windows with shades
|
384
|
+
# this is run as a separate step once all logic about construction sets is in place
|
385
|
+
sub_faces = @openstudio_model.getSubSurfaces()
|
386
|
+
sub_faces.each do |sub_face|
|
387
|
+
constr_ref = sub_face.construction
|
388
|
+
unless constr_ref.empty?
|
389
|
+
constr = constr_ref.get
|
390
|
+
constr_name_ref = constr.name
|
391
|
+
unless constr_name_ref.empty?
|
392
|
+
constr_name = constr_name_ref.get
|
393
|
+
unless $window_shade_hash[constr_name].nil?
|
394
|
+
window_shd_constr = $window_shade_hash[constr_name]
|
395
|
+
os_shd_control = window_shd_constr.to_openstudio_shading_control(@openstudio_model)
|
396
|
+
sub_face.setShadingControl(os_shd_control)
|
397
|
+
end
|
398
|
+
end
|
399
|
+
end
|
393
400
|
end
|
394
401
|
end
|
395
402
|
|
@@ -428,6 +435,36 @@ module FromHoneybee
|
|
428
435
|
end
|
429
436
|
end
|
430
437
|
|
438
|
+
def create_orphaned_shades
|
439
|
+
if @hash[:orphaned_shades]
|
440
|
+
shading_surface_group = OpenStudio::Model::ShadingSurfaceGroup.new(@openstudio_model)
|
441
|
+
shading_surface_group.setShadingSurfaceType('Building')
|
442
|
+
@hash[:orphaned_shades].each do |shade|
|
443
|
+
shade_object = Shade.new(shade)
|
444
|
+
openstudio_shade = shade_object.to_openstudio(@openstudio_model)
|
445
|
+
openstudio_shade.setShadingSurfaceGroup(shading_surface_group)
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
|
450
|
+
def create_orphaned_faces
|
451
|
+
if @hash[:orphaned_faces]
|
452
|
+
raise "Orphaned Faces are not translatable to OpenStudio."
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
def create_orphaned_apertures
|
457
|
+
if @hash[:orphaned_apertures]
|
458
|
+
raise "Orphaned Apertures are not translatable to OpenStudio."
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
def create_orphaned_doors
|
463
|
+
if @hash[:orphaned_doors]
|
464
|
+
raise "Orphaned Doors are not translatable to OpenStudio."
|
465
|
+
end
|
466
|
+
end
|
467
|
+
|
431
468
|
#TODO: create runlog for errors.
|
432
469
|
|
433
470
|
end # Model
|
@@ -58,10 +58,23 @@ module FromHoneybee
|
|
58
58
|
os_sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(openstudio_model)
|
59
59
|
os_sch_ruleset.setName(@hash[:identifier])
|
60
60
|
|
61
|
+
# assign schedule type limit
|
62
|
+
sch_type_limit_obj = nil
|
63
|
+
if @hash[:schedule_type_limit]
|
64
|
+
schedule_type_limit = openstudio_model.getScheduleTypeLimitsByName(@hash[:schedule_type_limit])
|
65
|
+
unless schedule_type_limit.empty?
|
66
|
+
sch_type_limit_obj = schedule_type_limit.get
|
67
|
+
os_sch_ruleset.setScheduleTypeLimits(sch_type_limit_obj)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
61
71
|
# loop through day schedules and create openstudio schedule day object
|
62
72
|
@hash[:day_schedules].each do |day_schedule|
|
63
73
|
day_schedule_new = OpenStudio::Model::ScheduleDay.new(openstudio_model)
|
64
74
|
day_schedule_new.setName(day_schedule[:identifier])
|
75
|
+
unless sch_type_limit_obj.nil?
|
76
|
+
day_schedule_new.setScheduleTypeLimits(sch_type_limit_obj)
|
77
|
+
end
|
65
78
|
values_day_new = day_schedule[:values]
|
66
79
|
times_day_new = day_schedule[:times]
|
67
80
|
times_day_new.delete_at(0) # Remove [0, 0] from array at index 0.
|
@@ -112,15 +125,6 @@ module FromHoneybee
|
|
112
125
|
os_sch_ruleset.defaultDaySchedule.addValue(times[i], values[i])
|
113
126
|
end
|
114
127
|
end
|
115
|
-
|
116
|
-
# assign schedule type limit
|
117
|
-
if @hash[:schedule_type_limit]
|
118
|
-
schedule_type_limit = openstudio_model.getScheduleTypeLimitsByName(@hash[:schedule_type_limit])
|
119
|
-
unless schedule_type_limit.empty?
|
120
|
-
schedule_type_limit_object = schedule_type_limit.get
|
121
|
-
os_sch_ruleset.setScheduleTypeLimits(schedule_type_limit_object)
|
122
|
-
end
|
123
|
-
end
|
124
128
|
|
125
129
|
# assign schedule rules
|
126
130
|
if @hash[:schedule_rules]
|
@@ -147,6 +147,18 @@ module FromHoneybee
|
|
147
147
|
|
148
148
|
# set defaults for the Model's ShadowCalculation object
|
149
149
|
os_shadow_calc = @openstudio_model.getShadowCalculation
|
150
|
+
begin
|
151
|
+
os_shadow_calc.setShadingCalculationMethod(
|
152
|
+
shdw_defaults[:calculation_method][:default])
|
153
|
+
rescue NoMethodError # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
154
|
+
os_shadow_calc.setCalculationMethod(
|
155
|
+
shdw_defaults[:calculation_method][:default])
|
156
|
+
end
|
157
|
+
begin
|
158
|
+
os_shadow_calc.setShadingCalculationUpdateFrequencyMethod(
|
159
|
+
shdw_defaults[:calculation_update_method][:default])
|
160
|
+
rescue # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
161
|
+
end
|
150
162
|
begin
|
151
163
|
os_shadow_calc.setShadingCalculationUpdateFrequency(
|
152
164
|
shdw_defaults[:calculation_frequency][:default])
|
@@ -156,16 +168,25 @@ module FromHoneybee
|
|
156
168
|
end
|
157
169
|
os_shadow_calc.setMaximumFiguresInShadowOverlapCalculations(
|
158
170
|
shdw_defaults[:maximum_figures][:default])
|
159
|
-
begin
|
160
|
-
os_shadow_calc.setShadingCalculationMethod(
|
161
|
-
shdw_defaults[:calculation_method][:default])
|
162
|
-
rescue NoMethodError # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
163
|
-
os_shadow_calc.setCalculationMethod(
|
164
|
-
shdw_defaults[:calculation_method][:default])
|
165
|
-
end
|
166
171
|
|
167
172
|
# override any ShadowCalculation defaults with lodaded JSON
|
168
173
|
if @hash[:shadow_calculation]
|
174
|
+
if @hash[:shadow_calculation][:calculation_method]
|
175
|
+
begin
|
176
|
+
os_shadow_calc.setShadingCalculationMethod(
|
177
|
+
@hash[:shadow_calculation][:calculation_method])
|
178
|
+
rescue NoMethodError # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
179
|
+
os_shadow_calc.setCalculationMethod(
|
180
|
+
@hash[:shadow_calculation][:calculation_method])
|
181
|
+
end
|
182
|
+
end
|
183
|
+
if @hash[:shadow_calculation][:calculation_update_method]
|
184
|
+
begin
|
185
|
+
os_shadow_calc.setShadingCalculationUpdateFrequencyMethod(
|
186
|
+
@hash[:shadow_calculation][:calculation_update_method])
|
187
|
+
rescue # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
188
|
+
end
|
189
|
+
end
|
169
190
|
if @hash[:shadow_calculation][:calculation_frequency]
|
170
191
|
begin
|
171
192
|
os_shadow_calc.setShadingCalculationUpdateFrequency(
|
@@ -176,19 +197,12 @@ module FromHoneybee
|
|
176
197
|
end
|
177
198
|
end
|
178
199
|
if @hash[:shadow_calculation][:maximum_figures]
|
179
|
-
os_shadow_calc.setMaximumFiguresInShadowOverlapCalculations(
|
180
|
-
|
181
|
-
if @hash[:shadow_calculation][:calculation_method]
|
182
|
-
begin
|
183
|
-
os_shadow_calc.setShadingCalculationMethod(
|
184
|
-
@hash[:shadow_calculation][:calculation_method])
|
185
|
-
rescue NoMethodError # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
186
|
-
os_shadow_calc.setCalculationMethod(
|
187
|
-
@hash[:shadow_calculation][:calculation_method])
|
188
|
-
end
|
200
|
+
os_shadow_calc.setMaximumFiguresInShadowOverlapCalculations(
|
201
|
+
@hash[:shadow_calculation][:maximum_figures])
|
189
202
|
end
|
190
203
|
if @hash[:shadow_calculation][:solar_distribution]
|
191
|
-
os_sim_control.setSolarDistribution(
|
204
|
+
os_sim_control.setSolarDistribution(
|
205
|
+
@hash[:shadow_calculation][:solar_distribution])
|
192
206
|
end
|
193
207
|
end
|
194
208
|
|
@@ -230,7 +244,6 @@ module FromHoneybee
|
|
230
244
|
begin
|
231
245
|
os_report = @openstudio_model.getOutputTableSummaryReports
|
232
246
|
rescue # REMOVE: Once the upgrade to OpenStudio 3.0 is official
|
233
|
-
os_report = OpenStudio::Model::OutputTableSummaryReports.new(@openstudio_model)
|
234
247
|
end
|
235
248
|
@hash[:output][:summary_reports].each do |report|
|
236
249
|
begin
|
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.
|
4
|
+
version: 2.2.0
|
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: 2020-
|
14
|
+
date: 2020-06-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/from_honeybee/construction/opaque.rb
|
172
172
|
- lib/from_honeybee/construction/shade.rb
|
173
173
|
- lib/from_honeybee/construction/window.rb
|
174
|
+
- lib/from_honeybee/construction/windowshade.rb
|
174
175
|
- lib/from_honeybee/construction_set.rb
|
175
176
|
- lib/from_honeybee/extension.rb
|
176
177
|
- lib/from_honeybee/geometry/aperture.rb
|