honeybee-openstudio 2.25.2 → 2.27.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/honeybee-openstudio.gemspec +1 -1
  3. data/lib/files/urbanopt_Gemfile +1 -1
  4. data/lib/from_openstudio/construction/air.rb +3 -0
  5. data/lib/from_openstudio/construction/opaque.rb +3 -0
  6. data/lib/from_openstudio/construction/shade.rb +3 -0
  7. data/lib/from_openstudio/construction/window.rb +3 -0
  8. data/lib/from_openstudio/construction_set.rb +3 -0
  9. data/lib/from_openstudio/material/opaque.rb +16 -1
  10. data/lib/from_openstudio/material/opaque_no_mass.rb +16 -1
  11. data/lib/from_openstudio/material/window_blind.rb +3 -0
  12. data/lib/from_openstudio/material/window_gas.rb +3 -0
  13. data/lib/from_openstudio/material/window_gas_custom.rb +3 -0
  14. data/lib/from_openstudio/material/window_gas_mixture.rb +3 -0
  15. data/lib/from_openstudio/material/window_glazing.rb +3 -0
  16. data/lib/from_openstudio/material/window_simpleglazsys.rb +3 -0
  17. data/lib/from_openstudio/schedule/fixed_interval.rb +3 -0
  18. data/lib/from_openstudio/schedule/ruleset.rb +3 -0
  19. data/lib/from_openstudio/schedule/type_limit.rb +3 -0
  20. data/lib/honeybee/_defaults/model.json +661 -29
  21. data/lib/honeybee/load/process.rb +42 -0
  22. data/lib/honeybee/model.rb +2 -1
  23. data/lib/honeybee/model_object.rb +41 -3
  24. data/lib/honeybee/simulation/parameter_model.rb +2 -1
  25. data/lib/honeybee.rb +1 -0
  26. data/lib/to_openstudio/construction/air.rb +3 -0
  27. data/lib/to_openstudio/construction/opaque.rb +3 -0
  28. data/lib/to_openstudio/construction/shade.rb +3 -0
  29. data/lib/to_openstudio/construction/window.rb +3 -1
  30. data/lib/to_openstudio/construction/windowshade.rb +3 -2
  31. data/lib/to_openstudio/construction_set.rb +3 -2
  32. data/lib/to_openstudio/geometry/aperture.rb +4 -0
  33. data/lib/to_openstudio/geometry/door.rb +4 -0
  34. data/lib/to_openstudio/geometry/face.rb +3 -0
  35. data/lib/to_openstudio/geometry/room.rb +12 -0
  36. data/lib/to_openstudio/geometry/shade.rb +3 -1
  37. data/lib/to_openstudio/hvac/ideal_air.rb +3 -1
  38. data/lib/to_openstudio/load/electric_equipment.rb +6 -0
  39. data/lib/to_openstudio/load/gas_equipment.rb +6 -0
  40. data/lib/to_openstudio/load/infiltration.rb +3 -1
  41. data/lib/to_openstudio/load/lighting.rb +3 -0
  42. data/lib/to_openstudio/load/people.rb +3 -0
  43. data/lib/to_openstudio/load/process.rb +100 -0
  44. data/lib/to_openstudio/load/ventilation.rb +3 -0
  45. data/lib/to_openstudio/material/opaque.rb +3 -0
  46. data/lib/to_openstudio/material/opaque_no_mass.rb +3 -1
  47. data/lib/to_openstudio/material/window_blind.rb +3 -1
  48. data/lib/to_openstudio/material/window_gas.rb +3 -1
  49. data/lib/to_openstudio/material/window_gas_custom.rb +3 -0
  50. data/lib/to_openstudio/material/window_gas_mixture.rb +3 -1
  51. data/lib/to_openstudio/material/window_glazing.rb +3 -1
  52. data/lib/to_openstudio/material/window_shade.rb +3 -1
  53. data/lib/to_openstudio/material/window_simpleglazsys.rb +3 -1
  54. data/lib/to_openstudio/program_type.rb +3 -1
  55. data/lib/to_openstudio/schedule/fixed_interval.rb +6 -1
  56. data/lib/to_openstudio/schedule/ruleset.rb +6 -1
  57. data/lib/to_openstudio/schedule/type_limit.rb +3 -1
  58. data/lib/to_openstudio.rb +1 -0
  59. metadata +4 -2
@@ -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
@@ -40,7 +40,8 @@ module Honeybee
40
40
  def self.read_from_disk(file)
41
41
  hash = nil
42
42
  File.open(File.join(file), 'r') do |f|
43
- hash = JSON.parse(f.read, symbolize_names: true)
43
+ hash = JSON.parse(File.read(f, :external_encoding => 'UTF-8',
44
+ :internal_encoding => 'UTF-8'), symbolize_names: true, encoding: 'UTF-8')
44
45
  end
45
46
  Model.new(hash)
46
47
  end
@@ -30,12 +30,34 @@
30
30
  # *******************************************************************************
31
31
 
32
32
  module Honeybee
33
+ class FakeOptionalString
34
+ def initialize(str)
35
+ @str = str
36
+ end
37
+
38
+ def empty?
39
+ false
40
+ end
41
+
42
+ def get
43
+ @str
44
+ end
45
+ end
46
+
33
47
  class ModelObject
34
48
  # Base class from which all other objects in this module inherit.
35
49
  # Attributes and methods of this class should be overwritten in each inheriting object.
36
50
 
37
51
  attr_reader :errors, :warnings
38
52
 
53
+ @@encoding_options = {
54
+ :invalid => :replace, # Replace invalid byte sequences
55
+ :undef => :replace, # Replace anything not defined in ASCII
56
+ :replace => '', # Use a blank for those replacements
57
+ :universal_newline => true # Always break lines with \n
58
+ }
59
+
60
+
39
61
  def method_missing(sym, *args)
40
62
  name = sym.to_s
41
63
  aname = name.sub('=', '')
@@ -57,7 +79,8 @@ module Honeybee
57
79
  def self.read_from_disk(file)
58
80
  hash = nil
59
81
  File.open(File.join(file), 'r') do |f|
60
- hash = JSON.parse(f.read, symbolize_names: true)
82
+ hash = JSON.parse(File.read(f, :external_encoding => 'UTF-8',
83
+ :internal_encoding => 'UTF-8'), symbolize_names: true, encoding: 'UTF-8')
61
84
  end
62
85
  new(hash)
63
86
  end
@@ -100,15 +123,30 @@ module Honeybee
100
123
 
101
124
  # remove illegal characters in identifier
102
125
  def self.clean_name(str)
103
- ascii = str.encode(Encoding.find('ASCII'))
126
+ ascii = str.encode(Encoding.find('ASCII'), **@@encoding_options)
104
127
  end
105
128
 
106
129
  # remove illegal characters in identifier
107
130
  def self.clean_identifier(str)
108
- encode_str = str.encode(Encoding.find('ASCII'))
131
+ encode_str = str.encode(Encoding.find('ASCII'), **@@encoding_options)
109
132
  encode_str.gsub(/[^.A-Za-z0-9_-]/, '_').gsub(' ', '_')
110
133
  end
111
134
 
135
+ # Create methods to get and set display name
136
+ if !OpenStudio::Model::ModelObject.method_defined?(:displayName)
137
+ OpenStudio::Model::ModelObject.class_eval do
138
+ define_method(:displayName) do
139
+ result = additionalProperties.getFeatureAsString("DisplayName")
140
+ if !result.empty?
141
+ result = FakeOptionalString.new(result.get.force_encoding(Encoding::UTF_8))
142
+ end
143
+ result
144
+ end
145
+ define_method(:setDisplayName) do |value|
146
+ additionalProperties.setFeature("DisplayName", value)
147
+ end
148
+ end
149
+ end
112
150
 
113
151
  end # ModelObject
114
152
  end # Honeybee
@@ -40,7 +40,8 @@ module Honeybee
40
40
  def self.read_from_disk(file)
41
41
  hash = nil
42
42
  File.open(File.join(file), 'r') do |f|
43
- hash = JSON.parse(f.read, symbolize_names: true)
43
+ hash = JSON.parse(File.read(f, :external_encoding => 'UTF-8',
44
+ :internal_encoding => 'UTF-8'), symbolize_names: true, encoding: 'UTF-8')
44
45
  end
45
46
 
46
47
  SimulationParameter.new(hash)
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'
@@ -46,6 +46,9 @@ module Honeybee
46
46
  os_construction = OpenStudio::Model::ConstructionAirBoundary.new(openstudio_model)
47
47
  os_construction.setName(@hash[:identifier])
48
48
  os_construction.setAirExchangeMethod('None')
49
+ unless @hash[:display_name].nil?
50
+ os_construction.setDisplayName(@hash[:display_name])
51
+ end
49
52
 
50
53
  os_construction
51
54
  end
@@ -46,6 +46,9 @@ module Honeybee
46
46
  # create construction and set identifier
47
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
48
48
  os_construction.setName(@hash[:identifier])
49
+ unless @hash[:display_name].nil?
50
+ os_construction.setDisplayName(@hash[:display_name])
51
+ end
49
52
 
50
53
  # create material vector
51
54
  os_materials = OpenStudio::Model::MaterialVector.new
@@ -46,6 +46,9 @@ module Honeybee
46
46
 
47
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
48
48
  os_construction.setName(@hash[:identifier])
49
+ unless @hash[:display_name].nil?
50
+ os_construction.setDisplayName(@hash[:display_name])
51
+ end
49
52
  os_materials = OpenStudio::Model::MaterialVector.new
50
53
 
51
54
  # create standard glazing if is specular is true
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create construction and set identifier
47
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
48
48
  os_construction.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_construction.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # create material vector
51
53
  os_materials = OpenStudio::Model::MaterialVector.new
52
54
  # loop through each layer and add to material vector
@@ -51,7 +51,6 @@ module Honeybee
51
51
  shd_id = @hash[:window_construction][:identifier]
52
52
  @hash[:window_construction][:identifier] = unshd_id
53
53
  @hash[:identifier] = shd_id
54
-
55
54
  # create the unshaded construction
56
55
  unshd_constr_obj = WindowConstructionAbridged.new(@hash[:window_construction])
57
56
  @construction = unshd_constr_obj.to_openstudio(openstudio_model)
@@ -59,7 +58,9 @@ module Honeybee
59
58
  # create the shaded construction
60
59
  @shade_construction = OpenStudio::Model::Construction.new(openstudio_model)
61
60
  @shade_construction.setName(shd_id)
62
-
61
+ unless @hash[:display_name].nil?
62
+ @shade_construction.setDisplayName(@hash[:display_name])
63
+ end
63
64
  # create the layers of the unshaded construction into which we will insert the shade
64
65
  os_materials = []
65
66
  if @hash.key?(:layers)
@@ -30,7 +30,6 @@
30
30
  # *******************************************************************************
31
31
 
32
32
  require 'honeybee/construction_set'
33
-
34
33
  require 'to_openstudio/model_object'
35
34
 
36
35
  module Honeybee
@@ -46,7 +45,9 @@ module Honeybee
46
45
  # create the constructionset object
47
46
  os_constr_set = OpenStudio::Model::DefaultConstructionSet.new(openstudio_model)
48
47
  os_constr_set.setName(@hash[:identifier])
49
-
48
+ unless @hash[:display_name].nil?
49
+ os_constr_set.setDisplayName(@hash[:display_name])
50
+ end
50
51
  int_surf_const = OpenStudio::Model::DefaultSurfaceConstructions.new(openstudio_model)
51
52
  ext_surf_const = OpenStudio::Model::DefaultSurfaceConstructions.new(openstudio_model)
52
53
  grnd_surf_const = OpenStudio::Model::DefaultSurfaceConstructions.new(openstudio_model)
@@ -114,6 +114,10 @@ module Honeybee
114
114
  os_subsurface.setName(@hash[:identifier])
115
115
  end
116
116
 
117
+ unless @hash[:display_name].nil?
118
+ os_subsurface.setDisplayName(@hash[:display_name])
119
+ end
120
+
117
121
  # assign the construction if it exists
118
122
  if @hash[:properties][:energy][:construction]
119
123
  construction_identifier = @hash[:properties][:energy][:construction]
@@ -114,6 +114,10 @@ module Honeybee
114
114
  os_subsurface.setName(@hash[:identifier])
115
115
  end
116
116
 
117
+ unless @hash[:display_name].nil?
118
+ os_subsurface.setDisplayName(@hash[:display_name])
119
+ end
120
+
117
121
  # assign the construction if it exists
118
122
  if @hash[:properties][:energy][:construction]
119
123
  construction_identifier = @hash[:properties][:energy][:construction]
@@ -60,6 +60,9 @@ module Honeybee
60
60
  # create the openstudio surface and assign the type
61
61
  os_surface = OpenStudio::Model::Surface.new(reordered_vertices, openstudio_model)
62
62
  os_surface.setName(@hash[:identifier])
63
+ unless @hash[:display_name].nil?
64
+ os_surface.setDisplayName(@hash[:display_name])
65
+ end
63
66
  os_surface.setSurfaceType(@hash[:face_type])
64
67
 
65
68
  # assign the construction if it is present
@@ -76,6 +76,9 @@ module Honeybee
76
76
  # create the space and thermal zone
77
77
  os_space = OpenStudio::Model::Space.new(openstudio_model)
78
78
  os_space.setName(@hash[:identifier])
79
+ unless @hash[:display_name].nil?
80
+ os_space.setDisplayName(@hash[:display_name])
81
+ end
79
82
  os_thermal_zone = OpenStudio::Model::ThermalZone.new(openstudio_model)
80
83
  os_thermal_zone.setName(@hash[:identifier])
81
84
  os_space.setThermalZone(os_thermal_zone)
@@ -382,6 +385,15 @@ module Honeybee
382
385
  end
383
386
  end
384
387
 
388
+ # assign any process loads if specified
389
+ if @hash[:properties][:energy][:process_loads]
390
+ @hash[:properties][:energy][:process_loads].each do |p_load|
391
+ hb_p_load = ProcessAbridged.new(p_load)
392
+ os_p_load = hb_p_load.to_openstudio(openstudio_model)
393
+ os_p_load.setSpace(os_space)
394
+ end
395
+ end
396
+
385
397
  os_space
386
398
  end
387
399
 
@@ -59,7 +59,9 @@ module Honeybee
59
59
 
60
60
  os_shading_surface = OpenStudio::Model::ShadingSurface.new(reordered_vertices, openstudio_model)
61
61
  os_shading_surface.setName(@hash[:identifier])
62
-
62
+ unless @hash[:display_name].nil?
63
+ os_shading_surface.setDisplayName(@hash[:display_name])
64
+ end
63
65
  # assign the construction if it exists
64
66
  if @hash[:properties][:energy][:construction]
65
67
  construction_identifier = @hash[:properties][:energy][:construction]
@@ -40,7 +40,9 @@ module Honeybee
40
40
  # create the ideal air system and set the identifier
41
41
  os_ideal_air = OpenStudio::Model::ZoneHVACIdealLoadsAirSystem.new(openstudio_model)
42
42
  os_ideal_air.setName(@hash[:identifier])
43
-
43
+ unless @hash[:display_name].nil?
44
+ os_ideal_air.setDisplayName(@hash[:display_name])
45
+ end
44
46
  # assign the economizer type
45
47
  if @hash[:economizer_type]
46
48
  os_ideal_air.setOutdoorAirEconomizerType(@hash[:economizer_type])
@@ -47,6 +47,9 @@ module Honeybee
47
47
  os_electric_equip_def = OpenStudio::Model::ElectricEquipmentDefinition.new(openstudio_model)
48
48
  os_electric_equip = OpenStudio::Model::ElectricEquipment.new(os_electric_equip_def)
49
49
  os_electric_equip_def.setName(@hash[:identifier])
50
+ unless @hash[:display_name].nil?
51
+ os_electric_equip_def.setDisplayName(@hash[:display_name])
52
+ end
50
53
  os_electric_equip.setName(@hash[:identifier])
51
54
 
52
55
  # assign watts per area
@@ -59,6 +62,9 @@ module Honeybee
59
62
  os_electric_equip.setSchedule(electric_equipment_schedule_object)
60
63
  end
61
64
 
65
+ # ensure that it's always reported under electric equipment
66
+ os_electric_equip.setEndUseSubcategory('Electric Equipment')
67
+
62
68
  # assign radiant fraction if it exists
63
69
  if @hash[:radiant_fraction]
64
70
  os_electric_equip_def.setFractionRadiant(@hash[:radiant_fraction])
@@ -48,6 +48,9 @@ module Honeybee
48
48
  os_gas_equip_def = OpenStudio::Model::GasEquipmentDefinition.new(openstudio_model)
49
49
  os_gas_equip = OpenStudio::Model::GasEquipment.new(os_gas_equip_def)
50
50
  os_gas_equip_def.setName(@hash[:identifier])
51
+ unless @hash[:display_name].nil?
52
+ os_gas_equip_def.setDisplayName(@hash[:display_name])
53
+ end
51
54
  os_gas_equip.setName(@hash[:identifier])
52
55
 
53
56
  # assign watts per space floor area
@@ -60,6 +63,9 @@ module Honeybee
60
63
  os_gas_equip.setSchedule(gas_equipment_schedule_object)
61
64
  end
62
65
 
66
+ # ensure that it's always reported under electric equipment
67
+ os_gas_equip.setEndUseSubcategory('Gas Equipment')
68
+
63
69
  # assign radiant fraction if it exists
64
70
  if @hash[:radiant_fraction]
65
71
  os_gas_equip_def.setFractionRadiant(@hash[:radiant_fraction])
@@ -47,7 +47,9 @@ module Honeybee
47
47
  # create infiltration OpenStudio object and set identifier
48
48
  os_infilt = OpenStudio::Model::SpaceInfiltrationDesignFlowRate.new(openstudio_model)
49
49
  os_infilt.setName(@hash[:identifier])
50
-
50
+ unless @hash[:display_name].nil?
51
+ os_infilt.setDisplayName(@hash[:display_name])
52
+ end
51
53
  # assign flow per surface
52
54
  os_infilt.setFlowperExteriorSurfaceArea(@hash[:flow_per_exterior_area])
53
55
 
@@ -48,6 +48,9 @@ module Honeybee
48
48
  os_lights_def = OpenStudio::Model::LightsDefinition.new(openstudio_model)
49
49
  os_lights = OpenStudio::Model::Lights.new(os_lights_def)
50
50
  os_lights_def.setName(@hash[:identifier])
51
+ unless @hash[:display_name].nil?
52
+ os_lights_def.setDisplayName(@hash[:display_name])
53
+ end
51
54
  os_lights.setName(@hash[:identifier])
52
55
 
53
56
  # assign watts per space floor area
@@ -48,6 +48,9 @@ module Honeybee
48
48
  os_people_def = OpenStudio::Model::PeopleDefinition.new(openstudio_model)
49
49
  os_people = OpenStudio::Model::People.new(os_people_def)
50
50
  os_people_def.setName(@hash[:identifier])
51
+ unless @hash[:display_name].nil?
52
+ os_people_def.setDisplayName(@hash[:display_name])
53
+ end
51
54
  os_people.setName(@hash[:identifier])
52
55
 
53
56
  # assign people per space floor area
@@ -0,0 +1,100 @@
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
+ unless @hash[:display_name].nil?
51
+ os_other_equip_def.setDisplayName(@hash[:display_name])
52
+ end
53
+ os_other_equip.setName(@hash[:identifier])
54
+
55
+ # assign watts
56
+ os_other_equip_def.setDesignLevel(@hash[:watts])
57
+
58
+ # assign schedule
59
+ other_equipment_schedule = openstudio_model.getScheduleByName(@hash[:schedule])
60
+ unless other_equipment_schedule.empty?
61
+ other_equipment_schedule_object = other_equipment_schedule.get
62
+ os_other_equip.setSchedule(other_equipment_schedule_object)
63
+ end
64
+
65
+ # assign the fuel type
66
+ os_other_equip.setFuelType(@hash[:fuel_type])
67
+
68
+ # assign the end use category if it exists
69
+ if @hash[:end_use_category]
70
+ os_other_equip.setEndUseSubcategory(@hash[:end_use_category])
71
+ else
72
+ os_other_equip.setEndUseSubcategory(defaults[:end_use_category][:default])
73
+ end
74
+
75
+ # assign radiant fraction if it exists
76
+ if @hash[:radiant_fraction]
77
+ os_other_equip_def.setFractionRadiant(@hash[:radiant_fraction])
78
+ else
79
+ os_other_equip_def.setFractionRadiant(defaults[:radiant_fraction][:default])
80
+ end
81
+
82
+ # assign latent fraction if it exists
83
+ if @hash[:latent_fraction]
84
+ os_other_equip_def.setFractionLatent(@hash[:latent_fraction])
85
+ else
86
+ os_other_equip_def.setFractionLatent(defaults[:latent_fraction][:default])
87
+ end
88
+
89
+ # assign lost fraction if it exists
90
+ if @hash[:lost_fraction]
91
+ os_other_equip_def.setFractionLost(@hash[:lost_fraction])
92
+ else
93
+ os_other_equip_def.setFractionLost(defaults[:lost_fraction][:default])
94
+ end
95
+
96
+ os_other_equip
97
+ end
98
+
99
+ end #ProcessAbridged
100
+ end #Honeybee
@@ -46,6 +46,9 @@ module Honeybee
46
46
  # create ventilation openstudio object and set identifier
47
47
  os_vent = OpenStudio::Model::DesignSpecificationOutdoorAir.new(openstudio_model)
48
48
  os_vent.setName(@hash[:identifier])
49
+ unless @hash[:display_name].nil?
50
+ os_vent.setDisplayName(@hash[:display_name])
51
+ end
49
52
 
50
53
  # assign air changes per hour if it exists
51
54
  if @hash[:air_changes_per_hour]
@@ -46,6 +46,9 @@ module Honeybee
46
46
  # create standard opaque OpenStudio material
47
47
  os_opaque_mat = OpenStudio::Model::StandardOpaqueMaterial.new(openstudio_model)
48
48
  os_opaque_mat.setName(@hash[:identifier])
49
+ unless @hash[:display_name].nil?
50
+ os_opaque_mat.setDisplayName(@hash[:display_name])
51
+ end
49
52
  os_opaque_mat.setThickness(@hash[:thickness])
50
53
  os_opaque_mat.setConductivity(@hash[:conductivity])
51
54
  os_opaque_mat.setDensity(@hash[:density])
@@ -47,7 +47,9 @@ module Honeybee
47
47
  # create no mass material OpenStudio object and set identifier
48
48
  os_nomass_mat = OpenStudio::Model::MasslessOpaqueMaterial.new(openstudio_model)
49
49
  os_nomass_mat.setName(@hash[:identifier])
50
-
50
+ unless @hash[:display_name].nil?
51
+ os_nomass_mat.setDisplayName(@hash[:display_name])
52
+ end
51
53
  # assign thermal resistance
52
54
  os_nomass_mat.setThermalResistance(@hash[:r_value])
53
55
 
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create blind OpenStudio object
47
47
  os_blind = OpenStudio::Model::Blind.new(openstudio_model)
48
48
  os_blind.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_blind.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # assign slat orientation
51
53
  if @hash[:slat_orientation]
52
54
  os_blind.setSlatOrientation(@hash[:slat_orientation])
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create window gas OpenStudio object
47
47
  os_window_gas = OpenStudio::Model::Gas.new(openstudio_model)
48
48
  os_window_gas.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_window_gas.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # assign thickness
51
53
  if @hash[:thickness]
52
54
  os_window_gas.setThickness(@hash[:thickness])
@@ -46,6 +46,9 @@ module Honeybee
46
46
  # create window gas openstudio object
47
47
  os_gas_custom = OpenStudio::Model::Gas.new(openstudio_model)
48
48
  os_gas_custom.setName(@hash[:identifier])
49
+ unless @hash[:display_name].nil?
50
+ os_gas_custom.setDisplayName(@hash[:display_name])
51
+ end
49
52
  os_gas_custom.setGasType('Custom')
50
53
  os_gas_custom.setConductivityCoefficientA(@hash[:conductivity_coeff_a])
51
54
  os_gas_custom.setViscosityCoefficientA(@hash[:viscosity_coeff_a])
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create the gas mixture
47
47
  os_gas_mixture = OpenStudio::Model::GasMixture.new(openstudio_model)
48
48
  os_gas_mixture.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_gas_mixture.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # set the thickness
51
53
  if @hash[:thickness]
52
54
  os_gas_mixture.setThickness(@hash[:thickness])
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create openstudio standard glazing object and set identifier
47
47
  os_glazing = OpenStudio::Model::StandardGlazing.new(openstudio_model)
48
48
  os_glazing.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_glazing.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # assign thickness
51
53
  if @hash[:thickness]
52
54
  os_glazing.setThickness(@hash[:thickness])
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create openstudio shade object
47
47
  os_shade_mat = OpenStudio::Model::Shade.new(openstudio_model)
48
48
  os_shade_mat.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_shade_mat.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # assign solar transmittance
51
53
  if @hash[:solar_transmittance]
52
54
  os_shade_mat.setSolarTransmittance(@hash[:solar_transmittance])
@@ -48,7 +48,9 @@ module Honeybee
48
48
  os_simple_glazing.setName(@hash[:identifier])
49
49
  os_simple_glazing.setUFactor(@hash[:u_factor])
50
50
  os_simple_glazing.setSolarHeatGainCoefficient(@hash[:shgc])
51
-
51
+ unless @hash[:display_name].nil?
52
+ os_simple_glazing.setDisplayName(@hash[:display_name])
53
+ end
52
54
  # assign visible transmittance
53
55
  if @hash[:vt]
54
56
  os_simple_glazing.setVisibleTransmittance(@hash[:vt])
@@ -46,7 +46,9 @@ module Honeybee
46
46
  # create openstudio space type object
47
47
  os_space_type = OpenStudio::Model::SpaceType.new(openstudio_model)
48
48
  os_space_type.setName(@hash[:identifier])
49
-
49
+ unless @hash[:display_name].nil?
50
+ os_space_type.setDisplayName(@hash[:display_name])
51
+ end
50
52
  # assign people
51
53
  if @hash[:people]
52
54
  people = PeopleAbridged.new(@hash[:people])
@@ -89,7 +89,9 @@ module Honeybee
89
89
  # create the new schedule
90
90
  os_fi_schedule = OpenStudio::Model::ScheduleFixedInterval.new(openstudio_model)
91
91
  os_fi_schedule.setName(@hash[:identifier])
92
-
92
+ unless @hash[:display_name].nil?
93
+ os_fi_schedule.setDisplayName(@hash[:display_name])
94
+ end
93
95
  # assign start date
94
96
  os_fi_schedule.setStartMonth(start_month)
95
97
  os_fi_schedule.setStartDay(start_day)
@@ -202,6 +204,9 @@ module Honeybee
202
204
  rowsToSkip = 1
203
205
  os_schedule_file = OpenStudio::Model::ScheduleFile.new(os_external_file, column, rowsToSkip)
204
206
  os_schedule_file.setName(@hash[:identifier])
207
+ unless @hash[:display_name].nil?
208
+ os_schedule_file.setDisplayName(@hash[:display_name])
209
+ end
205
210
  os_schedule_file.setInterpolatetoTimestep(interpolate)
206
211
  os_schedule_file.setMinutesperItem(interval_length)
207
212