honeybee-openstudio 2.6.6 → 2.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 441b7f7299d685f024debddb30a66437af776f87a6a8265e31d3930dbd445f65
4
- data.tar.gz: 5628a169394fae8ba244c485847ff3c9a0e06fdc18480660aaacc384a7ade24b
3
+ metadata.gz: 0b0da04a58221bdf1cd64089755dadb753e9c45feb2966a983a7aa9574dea77a
4
+ data.tar.gz: ef763660f47e53e7336f0b48cbaf99b89c924dbee72bef048977485d483db49e
5
5
  SHA512:
6
- metadata.gz: 824457466f2b48341f02121c6c77fd731433e01bf1fca30dbbd1aa54b033433ccded8e5a031c855b6f1a335bec8bb3b7c22d5ecc3471cf56761e88993638812b
7
- data.tar.gz: 5cffeeaf970a6252b54c1bc1f4cb7208f8c3d9a3db46828bc2c9e5b2f469bc43a5f2b970d7954096056d8e95269cf43bee7f0c1e0e9b209e0e34b6faf5b53498
6
+ metadata.gz: 862f2c7fa88498e78141a6293797e39e96f9b25d2e10ef8231c0899530917373774f4c4c26bfe674a7f9accc6d2e639dd0c3baab25bd543029b4740034a8ad75
7
+ data.tar.gz: 15bb34106c90a0f72f3e05fa5075636f2e4e28839b8a1820695087c3c2c1707e3aad9c6c2825f630f5db8e18753f8780484af2fa5005ce50a46ab67224aae114
@@ -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.6.6'
7
+ spec.version = '2.6.7'
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
 
@@ -54,6 +54,7 @@ module FromHoneybee
54
54
  def initialize(hash = {})
55
55
  super(hash)
56
56
  raise "Incorrect model type '#{@type}'" unless @type == 'Room'
57
+ @unique_space_type = nil
57
58
  end
58
59
 
59
60
  def defaults
@@ -66,6 +67,33 @@ module FromHoneybee
66
67
  nil
67
68
  end
68
69
 
70
+ def get_unique_space_type(openstudio_model, os_space)
71
+ # get a space type that is unique to the room
72
+ if @unique_space_type.nil?
73
+ space_type = os_space.spaceType
74
+ unless space_type.empty?
75
+ # copy the space type that is already assigned to the room
76
+ space_type_object = space_type.get
77
+ space_type_mod_obj = space_type_object.clone(openstudio_model)
78
+ new_space_type = space_type_mod_obj.to_SpaceType.get
79
+ else
80
+ # create a new space type as there is currently none assigned to the room
81
+ new_space_type = OpenStudio::Model::SpaceType.new(openstudio_model)
82
+ end
83
+ # give the space type a new unique name and assign it to the room
84
+ st_name = space_type_object.name
85
+ unless space_type.empty?
86
+ st_name = st_name.get
87
+ else
88
+ st_name = 'CustomSpaceType'
89
+ end
90
+ new_space_type.setName(st_name + '_' + @hash[:identifier])
91
+ os_space.setSpaceType(new_space_type)
92
+ @unique_space_type = new_space_type
93
+ end
94
+ @unique_space_type
95
+ end
96
+
69
97
  def to_openstudio(openstudio_model)
70
98
  # create the space and thermal zone
71
99
  os_space = OpenStudio::Model::Space.new(openstudio_model)
@@ -213,88 +241,75 @@ module FromHoneybee
213
241
  @hash[:outdoor_shades].each do |outdoor_shade|
214
242
  add_shade_to_group(openstudio_model, os_shd_group, outdoor_shade)
215
243
  end
216
- end
244
+ end
217
245
 
218
246
  #check whether there are any load objects on the room overriding the programtype
219
247
  if @hash[:properties][:energy][:people]
220
- people = openstudio_model.getPeopleByName(@hash[:properties][:energy][:people][:identifier])
221
- unless people.empty?
222
- people_object = people.get
223
- people_object.setSpace(os_space)
224
- else
225
- people_space = PeopleAbridged.new(@hash[:properties][:energy][:people])
226
- os_people_space = people_space.to_openstudio(openstudio_model)
227
- os_people_space.setSpace(os_space)
248
+ unique_program = get_unique_space_type(openstudio_model, os_space)
249
+ unique_program_ppl = unique_program.people
250
+ unless unique_program_ppl.empty? # remove the previous load definition
251
+ unique_program_ppl[0].remove()
228
252
  end
253
+ custom_people = PeopleAbridged.new(@hash[:properties][:energy][:people])
254
+ os_custom_people = custom_people.to_openstudio(openstudio_model)
255
+ os_custom_people.setSpaceType(unique_program) # assign the new load definition
229
256
  end
230
257
 
231
258
  # assign lighting if it exists
232
259
  if @hash[:properties][:energy][:lighting]
233
- lighting = openstudio_model.getLightsByName(@hash[:properties][:energy][:lighting][:identifier])
234
- unless lighting.empty?
235
- lighting_object = lighting.get
236
- lighting_object.setSpace(os_space)
237
- else
238
- lighting_space = LightingAbridged.new(@hash[:properties][:energy][:lighting])
239
- os_lighting_space = lighting_space.to_openstudio(openstudio_model)
240
- os_lighting_space.setSpace(os_space)
260
+ unique_program = get_unique_space_type(openstudio_model, os_space)
261
+ unique_program_lght = unique_program.lights
262
+ unless unique_program_lght.empty? # remove the previous load definition
263
+ unique_program_lght[0].remove()
241
264
  end
265
+ custom_lighting = LightingAbridged.new(@hash[:properties][:energy][:lighting])
266
+ os_custom_lighting = custom_lighting.to_openstudio(openstudio_model)
267
+ os_custom_lighting.setSpaceType(unique_program) # assign the new load definition
242
268
  end
243
269
 
244
270
  # assign electric equipment if it exists
245
271
  if @hash[:properties][:energy][:electric_equipment]
246
- electric_equipment = openstudio_model.getElectricEquipmentByName(
247
- @hash[:properties][:energy][:electric_equipment][:identifier])
248
- unless electric_equipment.empty?
249
- electric_equipment_object = electric_equipment.get
250
- electric_equipment_object.setSpace(os_space)
251
- else
252
- electric_equipment_space = ElectricEquipmentAbridged.new(@hash[:properties][:energy][:electric_equipment])
253
- os_electric_equipment_space = electric_equipment_space.to_openstudio(openstudio_model)
254
- os_electric_equipment_space.setSpace(os_space)
272
+ unique_program = get_unique_space_type(openstudio_model, os_space)
273
+ unique_program_ele = unique_program.electricEquipment
274
+ unless unique_program_ele.empty? # remove the previous load definition
275
+ unique_program_ele[0].remove()
255
276
  end
277
+ custom_electric_equipment = ElectricEquipmentAbridged.new(@hash[:properties][:energy][:electric_equipment])
278
+ os_custom_electric_equipment = custom_electric_equipment.to_openstudio(openstudio_model)
279
+ os_custom_electric_equipment.setSpaceType(unique_program) # assign the new load definition
256
280
  end
257
-
281
+
258
282
  # assign gas equipment if it exists
259
283
  if @hash[:properties][:energy][:gas_equipment]
260
- gas_equipment = openstudio_model.getGasEquipmentByName(
261
- @hash[:properties][:energy][:gas_equipment][:identifier])
262
- unless gas_equipment.empty?
263
- gas_equipment_object = gas_equipment.get
264
- gas_equipment_object.setSpace(os_space)
265
- else
266
- gas_equipment_space = GasEquipmentAbridged.new(@hash[:properties][:energy][:gas_equipment])
267
- os_gas_equipment_space = gas_equipment_space.to_openstudio(openstudio_model)
268
- os_gas_equipment_space.setSpace(os_space)
284
+ unique_program = get_unique_space_type(openstudio_model, os_space)
285
+ unique_program_gas = unique_program.gasEquipment
286
+ unless unique_program_gas.empty? # remove the previous load definition
287
+ unique_program_gas[0].remove()
269
288
  end
289
+ custom_gas_equipment = GasEquipmentAbridged.new(@hash[:properties][:energy][:gas_equipment])
290
+ os_custom_gas_equipment = custom_gas_equipment.to_openstudio(openstudio_model)
291
+ os_custom_gas_equipment.setSpaceType(unique_program) # assign the new load definition
270
292
  end
271
293
 
272
294
  # assign infiltration if it exists
273
295
  if @hash[:properties][:energy][:infiltration] && $use_simple_vent # only use infiltration with simple ventilation
274
- infiltration = openstudio_model.getSpaceInfiltrationDesignFlowRateByName(
275
- @hash[:properties][:energy][:infiltration][:identifier])
276
- unless infiltration.empty?
277
- infiltration_object = infiltration.get
278
- infiltration_object.setSpace(os_space)
279
- else
280
- infiltration_space = InfiltrationAbridged.new(@hash[:properties][:energy][:infiltration])
281
- os_infiltration_space = infiltration_space.to_openstudio(openstudio_model)
282
- os_infiltration_space.setSpace(os_space)
296
+ unique_program = get_unique_space_type(openstudio_model, os_space)
297
+ unique_program_inf = unique_program.spaceInfiltrationDesignFlowRates
298
+ unless unique_program_inf.empty? # remove the previous load definition
299
+ unique_program_inf[0].remove()
283
300
  end
301
+ custom_infiltration = InfiltrationAbridged.new(@hash[:properties][:energy][:infiltration])
302
+ os_custom_infiltration = custom_infiltration.to_openstudio(openstudio_model)
303
+ os_custom_infiltration.setSpaceType(unique_program) # assign the new load definition
284
304
  end
285
-
305
+
286
306
  # assign ventilation if it exists
287
307
  if @hash[:properties][:energy][:ventilation]
288
- ventilation = openstudio_model.getDesignSpecificationOutdoorAirByName(
289
- @hash[:properties][:energy][:ventilation][:identifier])
290
- unless ventilation.empty?
291
- ventilation_object = ventilation.get
292
- ventilation_object.setSpace(os_space)
293
- else
294
- ventilation_space = VentilationAbridged.new(@hash[:properties][:energy][:ventilation])
295
- os_ventilation_space = ventilation_space.to_openstudio(openstudio_model)
296
- os_space.setDesignSpecificationOutdoorAir(os_ventilation_space)
297
- end
308
+ unique_program = get_unique_space_type(openstudio_model, os_space)
309
+ unique_program.resetDesignSpecificationOutdoorAir()
310
+ custom_ventilation = VentilationAbridged.new(@hash[:properties][:energy][:ventilation])
311
+ os_custom_ventilation = custom_ventilation.to_openstudio(openstudio_model)
312
+ unique_program.setDesignSpecificationOutdoorAir(os_custom_ventilation)
298
313
  end
299
314
 
300
315
  # assign setpoint if it exists
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.6.6
4
+ version: 2.6.7
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-10-18 00:00:00.000000000 Z
14
+ date: 2020-10-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler