honeybee-openstudio 2.25.0 → 2.26.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,42 @@
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/model_object'
33
+
34
+ module Honeybee
35
+ class ProcessAbridged < ModelObject
36
+
37
+ def defaults
38
+ @@schema[:components][:schemas][:ProcessAbridged][:properties]
39
+ end
40
+
41
+ end #ProcessAbridged
42
+ end #Honeybee
@@ -36,6 +36,13 @@ module Honeybee
36
36
 
37
37
  attr_reader :errors, :warnings
38
38
 
39
+ @@encoding_options = {
40
+ :invalid => :replace, # Replace invalid byte sequences
41
+ :undef => :replace, # Replace anything not defined in ASCII
42
+ :replace => '', # Use a blank for those replacements
43
+ :universal_newline => true # Always break lines with \n
44
+ }
45
+
39
46
  def method_missing(sym, *args)
40
47
  name = sym.to_s
41
48
  aname = name.sub('=', '')
@@ -100,12 +107,12 @@ module Honeybee
100
107
 
101
108
  # remove illegal characters in identifier
102
109
  def self.clean_name(str)
103
- ascii = str.encode(Encoding.find('ASCII'))
110
+ ascii = str.encode(Encoding.find('ASCII'), **@@encoding_options)
104
111
  end
105
112
 
106
113
  # remove illegal characters in identifier
107
114
  def self.clean_identifier(str)
108
- encode_str = str.encode(Encoding.find('ASCII'))
115
+ encode_str = str.encode(Encoding.find('ASCII'), **@@encoding_options)
109
116
  encode_str.gsub(/[^.A-Za-z0-9_-]/, '_').gsub(' ', '_')
110
117
  end
111
118
 
data/lib/honeybee.rb CHANGED
@@ -79,6 +79,7 @@ require 'honeybee/load/ventilation'
79
79
  require 'honeybee/load/setpoint_thermostat'
80
80
  require 'honeybee/load/setpoint_humidistat'
81
81
  require 'honeybee/load/daylight'
82
+ require 'honeybee/load/process'
82
83
 
83
84
  # import the schedule objects
84
85
  require 'honeybee/schedule/type_limit'
@@ -382,6 +382,15 @@ module Honeybee
382
382
  end
383
383
  end
384
384
 
385
+ # assign any process loads if specified
386
+ if @hash[:properties][:energy][:process_loads]
387
+ @hash[:properties][:energy][:process_loads].each do |p_load|
388
+ hb_p_load = ProcessAbridged.new(p_load)
389
+ os_p_load = hb_p_load.to_openstudio(openstudio_model)
390
+ os_p_load.setSpace(os_space)
391
+ end
392
+ end
393
+
385
394
  os_space
386
395
  end
387
396
 
@@ -59,6 +59,9 @@ module Honeybee
59
59
  os_electric_equip.setSchedule(electric_equipment_schedule_object)
60
60
  end
61
61
 
62
+ # ensure that it's always reported under electric equipment
63
+ os_electric_equip.setEndUseSubcategory('Electric Equipment')
64
+
62
65
  # assign radiant fraction if it exists
63
66
  if @hash[:radiant_fraction]
64
67
  os_electric_equip_def.setFractionRadiant(@hash[:radiant_fraction])
@@ -60,6 +60,9 @@ module Honeybee
60
60
  os_gas_equip.setSchedule(gas_equipment_schedule_object)
61
61
  end
62
62
 
63
+ # ensure that it's always reported under electric equipment
64
+ os_gas_equip.setEndUseSubcategory('Gas Equipment')
65
+
63
66
  # assign radiant fraction if it exists
64
67
  if @hash[:radiant_fraction]
65
68
  os_gas_equip_def.setFractionRadiant(@hash[:radiant_fraction])
@@ -0,0 +1,97 @@
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/load/process'
33
+
34
+ require 'to_openstudio/model_object'
35
+
36
+ module Honeybee
37
+ class ProcessAbridged
38
+
39
+ def find_existing_openstudio_object(openstudio_model)
40
+ model_other_equipment = openstudio_model.getOtherEquipmentByName(@hash[:identifier])
41
+ return model_other_equipment.get unless model_other_equipment.empty?
42
+ nil
43
+ end
44
+
45
+ def to_openstudio(openstudio_model)
46
+ # create process load and set identifier
47
+ os_other_equip_def = OpenStudio::Model::OtherEquipmentDefinition.new(openstudio_model)
48
+ os_other_equip = OpenStudio::Model::OtherEquipment.new(os_other_equip_def)
49
+ os_other_equip_def.setName(@hash[:identifier])
50
+ os_other_equip.setName(@hash[:identifier])
51
+
52
+ # assign watts
53
+ os_other_equip_def.setDesignLevel(@hash[:watts])
54
+
55
+ # assign schedule
56
+ other_equipment_schedule = openstudio_model.getScheduleByName(@hash[:schedule])
57
+ unless other_equipment_schedule.empty?
58
+ other_equipment_schedule_object = other_equipment_schedule.get
59
+ os_other_equip.setSchedule(other_equipment_schedule_object)
60
+ end
61
+
62
+ # assign the fuel type
63
+ os_other_equip.setFuelType(@hash[:fuel_type])
64
+
65
+ # assign the end use category if it exists
66
+ if @hash[:end_use_category]
67
+ os_other_equip.setEndUseSubcategory(@hash[:end_use_category])
68
+ else
69
+ os_other_equip.setEndUseSubcategory(defaults[:end_use_category][:default])
70
+ end
71
+
72
+ # assign radiant fraction if it exists
73
+ if @hash[:radiant_fraction]
74
+ os_other_equip_def.setFractionRadiant(@hash[:radiant_fraction])
75
+ else
76
+ os_other_equip_def.setFractionRadiant(defaults[:radiant_fraction][:default])
77
+ end
78
+
79
+ # assign latent fraction if it exists
80
+ if @hash[:latent_fraction]
81
+ os_other_equip_def.setFractionLatent(@hash[:latent_fraction])
82
+ else
83
+ os_other_equip_def.setFractionLatent(defaults[:latent_fraction][:default])
84
+ end
85
+
86
+ # assign lost fraction if it exists
87
+ if @hash[:lost_fraction]
88
+ os_other_equip_def.setFractionLost(@hash[:lost_fraction])
89
+ else
90
+ os_other_equip_def.setFractionLost(defaults[:lost_fraction][:default])
91
+ end
92
+
93
+ os_other_equip
94
+ end
95
+
96
+ end #ProcessAbridged
97
+ end #Honeybee
@@ -82,9 +82,6 @@ module Honeybee
82
82
  hot_water_pump.setRatedPumpHead(29891) # default value in Pa from OpenStudio Application
83
83
  hot_water_pump.setMotorEfficiency(0.9) # default value from OpenStudio Application
84
84
  hot_water_pump.addToNode(hot_water_plant.supplyInletNode())
85
- if shw_hash[:equipment_type] != 'Default_District_SHW'
86
- hot_water_pump.setEndUseSubcategory('Water Systems')
87
- end
88
85
 
89
86
  eq_type = shw_hash[:equipment_type]
90
87
  if eq_type == 'Default_District_SHW'
@@ -171,7 +168,7 @@ module Honeybee
171
168
  if eq_type == 'HeatPump_WaterHeater'
172
169
  # create a coil for the heat pump
173
170
  heat_pump = OpenStudio::Model::CoilWaterHeatingAirToWaterHeatPump.new(openstudio_model)
174
- heat_pump.setName('HPWH DX Coil' + @@sys_count.to_s)
171
+ heat_pump.setName('SHW HPWH DX Coil' + @@sys_count.to_s)
175
172
  if shw_hash[:heater_efficiency].nil?
176
173
  heat_pump.setRatedCOP(3.5)
177
174
  else
data/lib/to_openstudio.rb CHANGED
@@ -79,6 +79,7 @@ require 'to_openstudio/load/ventilation'
79
79
  require 'to_openstudio/load/setpoint_thermostat'
80
80
  require 'to_openstudio/load/setpoint_humidistat'
81
81
  require 'to_openstudio/load/daylight'
82
+ require 'to_openstudio/load/process'
82
83
 
83
84
  # extend the schedule objects
84
85
  require 'to_openstudio/schedule/type_limit'
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.25.0
4
+ version: 2.26.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: 2021-10-10 00:00:00.000000000 Z
14
+ date: 2021-10-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -219,6 +219,7 @@ files:
219
219
  - lib/honeybee/load/infiltration.rb
220
220
  - lib/honeybee/load/lighting.rb
221
221
  - lib/honeybee/load/people.rb
222
+ - lib/honeybee/load/process.rb
222
223
  - lib/honeybee/load/service_hot_water.rb
223
224
  - lib/honeybee/load/setpoint_humidistat.rb
224
225
  - lib/honeybee/load/setpoint_thermostat.rb
@@ -298,6 +299,7 @@ files:
298
299
  - lib/to_openstudio/load/infiltration.rb
299
300
  - lib/to_openstudio/load/lighting.rb
300
301
  - lib/to_openstudio/load/people.rb
302
+ - lib/to_openstudio/load/process.rb
301
303
  - lib/to_openstudio/load/service_hot_water.rb
302
304
  - lib/to_openstudio/load/setpoint_humidistat.rb
303
305
  - lib/to_openstudio/load/setpoint_thermostat.rb