honeybee-openstudio 2.6.4 → 2.6.9

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: 1be0c026cdf0c7be58cad578c6aaa5bed7138ed766e5a5e0b046b33f1afa8391
4
- data.tar.gz: cd5e2acee1c4940ef49ba35c8c28638f558ca5ecfb7adce46e92fb2898fd7040
3
+ metadata.gz: e9807e9ab401382c3e1b8e98b86e5fe65c3efa5172ddd77103964f5bf69a7a8b
4
+ data.tar.gz: bec119606bedf177e4d6c77a80f6768fddd248545c73082d5808d0245724611c
5
5
  SHA512:
6
- metadata.gz: 19af3740a7d87564bf410a558e4c04329df1d64e0f1ce5da8e11cd7108b3c811b51aa055f208bb8dd47e0e1dfad7f5186fcdfe20ecd77d0705a39fa899f19baf
7
- data.tar.gz: 300f95099b8eb11c3a88b4172e262d24476de7fff4c2d509961e96a951ae7f13b8135ac203e1f5e442f06e110aca9ce142a2ba664666447327dd1aa1ae4b5b5c
6
+ metadata.gz: 3a68b8ffb0e9cbf31578366fde5120249016529862a1c984339b3946110c7a526de5375291d22e43f2fd565655dda0ddf1310eeec11d9d17b7c2000677e0214e
7
+ data.tar.gz: 8fddadbc9346bc173447a88a747dc4cd424966d4050a686be799fe52b64643977efe4d33b8e83269b395fc9b4233e9f08ff810a854b10c10b69e9281b0c9c982
@@ -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.4'
7
+ spec.version = '2.6.9'
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
 
@@ -21,4 +21,4 @@ else
21
21
  end
22
22
 
23
23
  # include the honeybee-openstudio-gem
24
- gem 'honeybee-openstudio', '2.5.3'
24
+ gem 'honeybee-openstudio', '2.6.4'
@@ -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,34 @@ 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
+ # give the space type a new unique name and assign it to the room
80
+ st_name = space_type_object.name
81
+ unless space_type.empty?
82
+ st_name = st_name.get
83
+ else
84
+ st_name = 'CustomSpaceType'
85
+ end
86
+ else
87
+ # create a new space type as there is currently none assigned to the room
88
+ new_space_type = OpenStudio::Model::SpaceType.new(openstudio_model)
89
+ st_name = 'CustomSpaceType'
90
+ end
91
+ new_space_type.setName(st_name + '_' + @hash[:identifier])
92
+ os_space.setSpaceType(new_space_type)
93
+ @unique_space_type = new_space_type
94
+ end
95
+ @unique_space_type
96
+ end
97
+
69
98
  def to_openstudio(openstudio_model)
70
99
  # create the space and thermal zone
71
100
  os_space = OpenStudio::Model::Space.new(openstudio_model)
@@ -213,88 +242,75 @@ module FromHoneybee
213
242
  @hash[:outdoor_shades].each do |outdoor_shade|
214
243
  add_shade_to_group(openstudio_model, os_shd_group, outdoor_shade)
215
244
  end
216
- end
245
+ end
217
246
 
218
247
  #check whether there are any load objects on the room overriding the programtype
219
248
  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)
249
+ unique_program = get_unique_space_type(openstudio_model, os_space)
250
+ unique_program_ppl = unique_program.people
251
+ unless unique_program_ppl.empty? # remove the previous load definition
252
+ unique_program_ppl[0].remove()
228
253
  end
254
+ custom_people = PeopleAbridged.new(@hash[:properties][:energy][:people])
255
+ os_custom_people = custom_people.to_openstudio(openstudio_model)
256
+ os_custom_people.setSpaceType(unique_program) # assign the new load definition
229
257
  end
230
258
 
231
259
  # assign lighting if it exists
232
260
  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)
261
+ unique_program = get_unique_space_type(openstudio_model, os_space)
262
+ unique_program_lght = unique_program.lights
263
+ unless unique_program_lght.empty? # remove the previous load definition
264
+ unique_program_lght[0].remove()
241
265
  end
266
+ custom_lighting = LightingAbridged.new(@hash[:properties][:energy][:lighting])
267
+ os_custom_lighting = custom_lighting.to_openstudio(openstudio_model)
268
+ os_custom_lighting.setSpaceType(unique_program) # assign the new load definition
242
269
  end
243
270
 
244
271
  # assign electric equipment if it exists
245
272
  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)
273
+ unique_program = get_unique_space_type(openstudio_model, os_space)
274
+ unique_program_ele = unique_program.electricEquipment
275
+ unless unique_program_ele.empty? # remove the previous load definition
276
+ unique_program_ele[0].remove()
255
277
  end
278
+ custom_electric_equipment = ElectricEquipmentAbridged.new(@hash[:properties][:energy][:electric_equipment])
279
+ os_custom_electric_equipment = custom_electric_equipment.to_openstudio(openstudio_model)
280
+ os_custom_electric_equipment.setSpaceType(unique_program) # assign the new load definition
256
281
  end
257
-
282
+
258
283
  # assign gas equipment if it exists
259
284
  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)
285
+ unique_program = get_unique_space_type(openstudio_model, os_space)
286
+ unique_program_gas = unique_program.gasEquipment
287
+ unless unique_program_gas.empty? # remove the previous load definition
288
+ unique_program_gas[0].remove()
269
289
  end
290
+ custom_gas_equipment = GasEquipmentAbridged.new(@hash[:properties][:energy][:gas_equipment])
291
+ os_custom_gas_equipment = custom_gas_equipment.to_openstudio(openstudio_model)
292
+ os_custom_gas_equipment.setSpaceType(unique_program) # assign the new load definition
270
293
  end
271
294
 
272
295
  # assign infiltration if it exists
273
296
  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)
297
+ unique_program = get_unique_space_type(openstudio_model, os_space)
298
+ unique_program_inf = unique_program.spaceInfiltrationDesignFlowRates
299
+ unless unique_program_inf.empty? # remove the previous load definition
300
+ unique_program_inf[0].remove()
283
301
  end
302
+ custom_infiltration = InfiltrationAbridged.new(@hash[:properties][:energy][:infiltration])
303
+ os_custom_infiltration = custom_infiltration.to_openstudio(openstudio_model)
304
+ os_custom_infiltration.setSpaceType(unique_program) # assign the new load definition
284
305
  end
285
-
306
+
286
307
  # assign ventilation if it exists
287
308
  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
309
+ unique_program = get_unique_space_type(openstudio_model, os_space)
310
+ unique_program.resetDesignSpecificationOutdoorAir()
311
+ custom_ventilation = VentilationAbridged.new(@hash[:properties][:energy][:ventilation])
312
+ os_custom_ventilation = custom_ventilation.to_openstudio(openstudio_model)
313
+ unique_program.setDesignSpecificationOutdoorAir(os_custom_ventilation)
298
314
  end
299
315
 
300
316
  # assign setpoint if it exists
@@ -180,6 +180,16 @@ module FromHoneybee
180
180
  $interior_afn_srf_hash = Hash.new # track whether an adjacent surface is already in the AFN
181
181
 
182
182
  # create all of the non-geometric model elements
183
+ if log_report # schedules are used by all other objects and come first
184
+ puts 'Translating Schedules'
185
+ end
186
+ if @hash[:properties][:energy][:schedule_type_limits]
187
+ create_schedule_type_limits(@hash[:properties][:energy][:schedule_type_limits])
188
+ end
189
+ if @hash[:properties][:energy][:schedules]
190
+ create_schedules(@hash[:properties][:energy][:schedules])
191
+ end
192
+
183
193
  if log_report
184
194
  puts 'Translating Materials'
185
195
  end
@@ -201,16 +211,6 @@ module FromHoneybee
201
211
  create_construction_sets(@hash[:properties][:energy][:construction_sets])
202
212
  end
203
213
 
204
- if log_report
205
- puts 'Translating Schedules'
206
- end
207
- if @hash[:properties][:energy][:schedule_type_limits]
208
- create_schedule_type_limits(@hash[:properties][:energy][:schedule_type_limits])
209
- end
210
- if @hash[:properties][:energy][:schedules]
211
- create_schedules(@hash[:properties][:energy][:schedules])
212
- end
213
-
214
214
  if log_report
215
215
  puts 'Translating ProgramTypes'
216
216
  end
@@ -98,6 +98,20 @@ module FromHoneybee
98
98
  @@sensor_count = @@sensor_count + 1
99
99
  in_air_temp.setName(in_sensor_name)
100
100
 
101
+ # set up a schedule sensor if there's a schedule specified
102
+ if @hash[:schedule]
103
+ vent_sch = openstudio_model.getScheduleByName(@hash[:schedule])
104
+ unless vent_sch.empty? # schedule not specified
105
+ sch_var = OpenStudio::Model::OutputVariable.new('Schedule Value', openstudio_model)
106
+ sch_var.setReportingFrequency('Timestep')
107
+ sch_var.setKeyValue(@hash[:schedule])
108
+ sch_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(openstudio_model, sch_var)
109
+ sch_sensor_name = replace_ems_special_characters(os_zone_name) + '_Sensor' + @@sensor_count.to_s
110
+ @@sensor_count = @@sensor_count + 1
111
+ sch_sens.setName(sch_sensor_name)
112
+ end
113
+ end
114
+
101
115
  # create the actuators for each of the operaable windows
102
116
  actuator_names = []
103
117
  vent_opening_surfaces.each do |vent_srf|
@@ -140,6 +154,10 @@ module FromHoneybee
140
154
  if delta_in_out && delta_in_out != defaults[:delta_temperature][:default]
141
155
  logic_statements << '((' + in_sensor_name + ' - Outdoor_Sensor) > ' + delta_in_out.to_s + ')'
142
156
  end
157
+ # check the schedule for ventilation
158
+ if sch_sensor_name
159
+ logic_statements << '(' + sch_sensor_name + ' > 0)'
160
+ end
143
161
  # create the complete logic statement for opening windows
144
162
  if logic_statements.empty?
145
163
  complete_logic = 'IF (Outdoor_Sensor < 100)' # no logic has been provided; always open windows
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.4
4
+ version: 2.6.9
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-09-10 00:00:00.000000000 Z
14
+ date: 2020-11-21 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler