honeybee-openstudio 2.6.9 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/pull_request.yaml +25 -0
  3. data/.gitignore +1 -0
  4. data/README.md +5 -5
  5. data/Rakefile +2 -7
  6. data/doc_templates/README.md.erb +42 -0
  7. data/doc_templates/copyright_erb.txt +2 -2
  8. data/doc_templates/copyright_ruby.txt +2 -2
  9. data/honeybee-openstudio.gemspec +11 -7
  10. data/lib/files/Honeybee.rb +7 -7
  11. data/lib/from_openstudio.rb +49 -0
  12. data/lib/from_openstudio/geometry/aperture.rb +136 -0
  13. data/lib/from_openstudio/geometry/door.rb +136 -0
  14. data/lib/from_openstudio/geometry/face.rb +174 -0
  15. data/lib/from_openstudio/geometry/room.rb +121 -0
  16. data/lib/from_openstudio/geometry/shade.rb +87 -0
  17. data/lib/from_openstudio/model.rb +123 -0
  18. data/lib/from_openstudio/model_object.rb +43 -0
  19. data/lib/from_openstudio/simulation/design_day.rb +123 -0
  20. data/lib/from_openstudio/simulation/parameter_model.rb +93 -0
  21. data/lib/from_openstudio/simulation/simulation_output.rb +67 -0
  22. data/lib/{from_honeybee.rb → honeybee.rb} +47 -40
  23. data/lib/{from_honeybee → honeybee}/_defaults/energy_default.json +0 -0
  24. data/lib/{from_honeybee → honeybee}/_defaults/model.json +0 -0
  25. data/lib/{from_honeybee → honeybee}/_defaults/simulation-parameter.json +1 -0
  26. data/lib/honeybee/construction/air.rb +42 -0
  27. data/lib/honeybee/construction/opaque.rb +42 -0
  28. data/lib/honeybee/construction/shade.rb +42 -0
  29. data/lib/honeybee/construction/window.rb +51 -0
  30. data/lib/honeybee/construction/windowshade.rb +43 -0
  31. data/lib/honeybee/construction_set.rb +42 -0
  32. data/lib/{from_honeybee → honeybee}/extension.rb +5 -5
  33. data/lib/honeybee/geometry/aperture.rb +42 -0
  34. data/lib/honeybee/geometry/door.rb +42 -0
  35. data/lib/honeybee/geometry/face.rb +48 -0
  36. data/lib/honeybee/geometry/room.rb +56 -0
  37. data/lib/honeybee/geometry/shade.rb +42 -0
  38. data/lib/honeybee/hvac/ideal_air.rb +42 -0
  39. data/lib/honeybee/hvac/template.rb +73 -0
  40. data/lib/honeybee/load/electric_equipment.rb +42 -0
  41. data/lib/honeybee/load/gas_equipment.rb +42 -0
  42. data/lib/honeybee/load/infiltration.rb +42 -0
  43. data/lib/{from_honeybee/simulation/extension.rb → honeybee/load/lighting.rb} +10 -13
  44. data/lib/honeybee/load/people.rb +42 -0
  45. data/lib/honeybee/load/setpoint_humidistat.rb +46 -0
  46. data/lib/honeybee/load/setpoint_thermostat.rb +46 -0
  47. data/lib/honeybee/load/ventilation.rb +42 -0
  48. data/lib/honeybee/material/opaque.rb +42 -0
  49. data/lib/honeybee/material/opaque_no_mass.rb +42 -0
  50. data/lib/honeybee/material/window_blind.rb +42 -0
  51. data/lib/honeybee/material/window_gas.rb +42 -0
  52. data/lib/honeybee/material/window_gas_custom.rb +42 -0
  53. data/lib/honeybee/material/window_gas_mixture.rb +42 -0
  54. data/lib/honeybee/material/window_glazing.rb +42 -0
  55. data/lib/honeybee/material/window_shade.rb +42 -0
  56. data/lib/honeybee/material/window_simpleglazsys.rb +42 -0
  57. data/lib/honeybee/model.rb +87 -0
  58. data/lib/{from_honeybee → honeybee}/model_object.rb +16 -18
  59. data/lib/honeybee/program_type.rb +56 -0
  60. data/lib/honeybee/schedule/fixed_interval.rb +42 -0
  61. data/lib/honeybee/schedule/ruleset.rb +42 -0
  62. data/lib/honeybee/schedule/type_limit.rb +42 -0
  63. data/lib/honeybee/simulation/design_day.rb +42 -0
  64. data/lib/honeybee/simulation/parameter_model.rb +86 -0
  65. data/lib/honeybee/simulation/simulation_output.rb +42 -0
  66. data/lib/honeybee/ventcool/control.rb +42 -0
  67. data/lib/honeybee/ventcool/opening.rb +46 -0
  68. data/lib/honeybee/ventcool/simulation.rb +42 -0
  69. data/lib/measures/from_honeybee_model/LICENSE.md +18 -22
  70. data/lib/measures/from_honeybee_model/measure.rb +4 -4
  71. data/lib/measures/from_honeybee_model/measure.xml +14 -37
  72. data/lib/measures/from_honeybee_model/tests/from_honeybee_model_test.rb +2 -2
  73. data/lib/measures/from_honeybee_simulation_parameter/LICENSE.md +18 -22
  74. data/lib/measures/from_honeybee_simulation_parameter/measure.rb +4 -4
  75. data/lib/measures/from_honeybee_simulation_parameter/measure.xml +15 -20
  76. data/lib/measures/from_honeybee_simulation_parameter/tests/from_honeybee_simulation_parameter_test.rb +3 -3
  77. data/lib/to_openstudio.rb +92 -0
  78. data/lib/{from_honeybee → to_openstudio}/construction/air.rb +7 -16
  79. data/lib/{from_honeybee → to_openstudio}/construction/opaque.rb +9 -19
  80. data/lib/{from_honeybee → to_openstudio}/construction/shade.rb +17 -26
  81. data/lib/{from_honeybee → to_openstudio}/construction/window.rb +12 -21
  82. data/lib/{from_honeybee → to_openstudio}/construction/windowshade.rb +8 -23
  83. data/lib/{from_honeybee → to_openstudio}/construction_set.rb +11 -23
  84. data/lib/{from_honeybee → to_openstudio}/geometry/aperture.rb +22 -32
  85. data/lib/{from_honeybee → to_openstudio}/geometry/door.rb +21 -31
  86. data/lib/{from_honeybee → to_openstudio}/geometry/face.rb +11 -28
  87. data/lib/{from_honeybee → to_openstudio}/geometry/room.rb +15 -38
  88. data/lib/{from_honeybee → to_openstudio}/geometry/shade.rb +8 -18
  89. data/lib/{from_honeybee → to_openstudio}/hvac/Model.hvac.rb +2 -2
  90. data/lib/{from_honeybee → to_openstudio}/hvac/ideal_air.rb +10 -19
  91. data/lib/{from_honeybee → to_openstudio}/hvac/template.rb +9 -43
  92. data/lib/{from_honeybee → to_openstudio}/load/electric_equipment.rb +12 -21
  93. data/lib/{from_honeybee → to_openstudio}/load/gas_equipment.rb +13 -22
  94. data/lib/{from_honeybee → to_openstudio}/load/infiltration.rb +14 -23
  95. data/lib/{from_honeybee → to_openstudio}/load/lighting.rb +10 -19
  96. data/lib/{from_honeybee → to_openstudio}/load/people.rb +9 -18
  97. data/lib/{from_honeybee → to_openstudio}/load/setpoint_humidistat.rb +8 -17
  98. data/lib/{from_honeybee → to_openstudio}/load/setpoint_thermostat.rb +8 -17
  99. data/lib/{from_honeybee → to_openstudio}/load/ventilation.rb +11 -20
  100. data/lib/{from_honeybee → to_openstudio}/material/opaque.rb +7 -16
  101. data/lib/{from_honeybee → to_openstudio}/material/opaque_no_mass.rb +8 -17
  102. data/lib/{from_honeybee → to_openstudio}/material/window_blind.rb +27 -36
  103. data/lib/{from_honeybee → to_openstudio}/material/window_gas.rb +8 -17
  104. data/lib/{from_honeybee → to_openstudio}/material/window_gas_custom.rb +10 -20
  105. data/lib/{from_honeybee → to_openstudio}/material/window_gas_mixture.rb +9 -18
  106. data/lib/{from_honeybee → to_openstudio}/material/window_glazing.rb +21 -30
  107. data/lib/{from_honeybee → to_openstudio}/material/window_shade.rb +17 -26
  108. data/lib/{from_honeybee → to_openstudio}/material/window_simpleglazsys.rb +7 -16
  109. data/lib/{from_honeybee → to_openstudio}/model.rb +13 -103
  110. data/lib/to_openstudio/model_object.rb +52 -0
  111. data/lib/{from_honeybee → to_openstudio}/program_type.rb +14 -34
  112. data/lib/{from_honeybee → to_openstudio}/schedule/fixed_interval.rb +11 -21
  113. data/lib/{from_honeybee → to_openstudio}/schedule/ruleset.rb +43 -44
  114. data/lib/{from_honeybee → to_openstudio}/schedule/type_limit.rb +9 -21
  115. data/lib/{from_honeybee/simulation/designday.rb → to_openstudio/simulation/design_day.rb} +7 -16
  116. data/lib/{from_honeybee/simulation/parameter.rb → to_openstudio/simulation/parameter_model.rb} +8 -57
  117. data/lib/{from_honeybee → to_openstudio}/ventcool/control.rb +8 -17
  118. data/lib/{from_honeybee → to_openstudio}/ventcool/opening.rb +8 -22
  119. data/lib/{from_honeybee → to_openstudio}/ventcool/simulation.rb +7 -16
  120. metadata +105 -134
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,21 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
33
-
34
- require 'openstudio'
32
+ require 'honeybee/construction/air'
35
33
 
36
- module FromHoneybee
37
- class AirBoundaryConstructionAbridged < ModelObject
38
- attr_reader :errors, :warnings
34
+ require 'to_openstudio/model_object'
39
35
 
40
- def initialize(hash = {})
41
- super(hash)
42
- end
43
-
44
- def defaults
45
- @@schema[:components][:schemas][:AirBoundaryConstructionAbridged][:properties]
46
- end
36
+ module Honeybee
37
+ class AirBoundaryConstructionAbridged
47
38
 
48
39
  def find_existing_openstudio_object(openstudio_model)
49
40
  object = openstudio_model.getConstructionByName(@hash[:identifier])
@@ -67,4 +58,4 @@ module FromHoneybee
67
58
  end
68
59
 
69
60
  end #AirBoundaryConstructionAbridged
70
- end #FromHoneybee
61
+ end #Honeybee
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,21 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
33
-
34
- require 'openstudio'
35
-
36
- module FromHoneybee
37
- class OpaqueConstructionAbridged < ModelObject
38
- attr_reader :errors, :warnings
32
+ require 'honeybee/construction/opaque'
39
33
 
40
- def initialize(hash = {})
41
- super(hash)
42
- end
34
+ require 'to_openstudio/model_object'
43
35
 
44
- def defaults
45
- @@schema[:components][:schemas][:OpaqueConstructionAbridged][:properties]
46
- end
36
+ module Honeybee
37
+ class OpaqueConstructionAbridged
47
38
 
48
39
  def find_existing_openstudio_object(openstudio_model)
49
40
  object = openstudio_model.getConstructionByName(@hash[:identifier])
@@ -55,8 +46,8 @@ module FromHoneybee
55
46
  # create construction and set identifier
56
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
57
48
  os_construction.setName(@hash[:identifier])
58
-
59
- # create material vector
49
+
50
+ # create material vector
60
51
  os_materials = OpenStudio::Model::MaterialVector.new
61
52
  # loop through each layer and add to material vector
62
53
  @hash[:layers].each do |layer|
@@ -73,5 +64,4 @@ module FromHoneybee
73
64
  end
74
65
 
75
66
  end #OpaqueConstructionAbridged
76
- end #FromHoneybee
77
-
67
+ end #Honeybee
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,21 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
32
+ require 'honeybee/construction/shade'
33
33
 
34
- require 'openstudio'
34
+ require 'to_openstudio/model_object'
35
35
 
36
- module FromHoneybee
36
+ module Honeybee
37
37
  class ShadeConstruction < ModelObject
38
- attr_reader :errors, :warnings
39
-
40
- def initialize(hash = {})
41
- super(hash)
42
- end
43
-
44
- def defaults
45
- @@schema[:components][:schemas][:ShadeConstruction][:properties]
46
- end
47
38
 
48
39
  def find_existing_openstudio_object(openstudio_model)
49
40
  object = openstudio_model.getConstructionByName(@hash[:identifier])
@@ -52,7 +43,7 @@ module FromHoneybee
52
43
  end
53
44
 
54
45
  def to_openstudio(openstudio_model)
55
-
46
+
56
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
57
48
  os_construction.setName(@hash[:identifier])
58
49
  os_materials = OpenStudio::Model::MaterialVector.new
@@ -60,14 +51,14 @@ module FromHoneybee
60
51
  # create standard glazing if is specular is true
61
52
  if @hash[:is_specular] == true
62
53
  os_material = OpenStudio::Model::StandardGlazing.new(openstudio_model)
63
-
54
+
64
55
  # assign solar reflectance
65
56
  if @hash[:solar_reflectance]
66
57
  os_material.setFrontSideSolarReflectanceatNormalIncidence(@hash[:solar_reflectance])
67
58
  else
68
59
  os_material.setFrontSideSolarReflectanceatNormalIncidence(defaults[:solar_reflectance][:default])
69
60
  end
70
-
61
+
71
62
  # assign visible reflectance
72
63
  if @hash[:visible_reflectance]
73
64
  os_material.setFrontSideVisibleReflectanceatNormalIncidence(@hash[:visible_reflectance])
@@ -75,34 +66,34 @@ module FromHoneybee
75
66
  os_material.setFrontSideVisibleReflectanceatNormalIncidence(defaults[:solar_reflectance][:default])
76
67
  end
77
68
 
78
- # create standard opaque material if is specular is false
69
+ # create standard opaque material if is specular is false
79
70
  else
80
71
  os_material = OpenStudio::Model::StandardOpaqueMaterial.new(openstudio_model)
81
-
72
+
82
73
  # assign solar reflectance
83
74
  if @hash[:solar_reflectance]
84
75
  os_material.setSolarReflectance(OpenStudio::OptionalDouble.new(@hash[:solar_reflectance]))
85
- else
76
+ else
86
77
  os_material.setSolarReflectance(OpenStudio::OptionalDouble.new(defaults[:visible_reflectance][:default]))
87
78
  end
88
-
79
+
89
80
  # assign visible reflectance
90
81
  if @hash[:visible_reflectance]
91
82
  os_material.setVisibleReflectance(OpenStudio::OptionalDouble.new(@hash[:visible_reflectance]))
92
- else
83
+ else
93
84
  os_material.setVisibleReflectance(OpenStudio::OptionalDouble.new(defaults[:solar_reflectance][:default]))
94
85
  end
95
-
86
+
96
87
  # assign specific heat
97
88
  os_material.setSpecificHeat(100) # bug in OpenStudio default Specific Heat is 0.1.
98
89
  end
99
-
90
+
100
91
  # add materials and set layers to construction
101
92
  os_materials << os_material
102
93
  os_construction.setLayers(os_materials)
103
94
  os_construction
104
-
95
+
105
96
  end
106
97
 
107
98
  end #ShadeConstruction
108
- end #FromHoneybee
99
+ end #Honeybee
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,21 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
33
-
34
- require 'openstudio'
32
+ require 'honeybee/construction/window'
35
33
 
36
- module FromHoneybee
37
- class WindowConstructionAbridged < ModelObject
38
- attr_reader :errors, :warnings
39
-
40
- def initialize(hash = {})
41
- super(hash)
42
- end
34
+ require 'to_openstudio/model_object'
43
35
 
44
- def defaults
45
- @@schema[:components][:schemas][:WindowConstructionAbridged][:properties]
46
- end
36
+ module Honeybee
37
+ class WindowConstructionAbridged
47
38
 
48
39
  def find_existing_openstudio_object(openstudio_model)
49
40
  object = openstudio_model.getConstructionByName(@hash[:identifier])
@@ -52,11 +43,11 @@ module FromHoneybee
52
43
  end
53
44
 
54
45
  def to_openstudio(openstudio_model)
55
- # create construction and set identifier
46
+ # create construction and set identifier
56
47
  os_construction = OpenStudio::Model::Construction.new(openstudio_model)
57
48
  os_construction.setName(@hash[:identifier])
58
-
59
- # create material vector
49
+
50
+ # create material vector
60
51
  os_materials = OpenStudio::Model::MaterialVector.new
61
52
  # loop through each layer and add to material vector
62
53
  @hash[:layers].each do |layer|
@@ -73,7 +64,7 @@ module FromHoneybee
73
64
  end
74
65
 
75
66
  end #WindowConstructionAbridged
76
- end #FromHoneybee
67
+ end #Honeybee
68
+
69
+
77
70
 
78
-
79
-
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,29 +29,14 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
33
- require 'from_honeybee/construction/window'
34
-
35
- require 'openstudio'
32
+ require 'honeybee/construction/windowshade'
36
33
 
37
- module FromHoneybee
38
- class WindowConstructionShadeAbridged < ModelObject
39
- attr_reader :errors, :warnings
34
+ require 'to_openstudio/model_object'
40
35
 
41
- def initialize(hash = {})
42
- super(hash)
43
- @construction = nil
44
- @shade_construction = nil
45
- @shade_location = nil
46
- @shade_material = nil
47
- @control_type = nil
48
- @setpoint = nil
49
- @schedule = nil
50
- end
36
+ module Honeybee
37
+ class WindowConstructionShadeAbridged
51
38
 
52
- def defaults
53
- @@schema[:components][:schemas][:WindowConstructionShadeAbridged][:properties]
54
- end
39
+ attr_reader :construction, :shade_construction, :shade_location, :shade_material, :control_type, :setpoint, :schedule
55
40
 
56
41
  def find_existing_openstudio_object(openstudio_model)
57
42
  object = openstudio_model.getConstructionByName(@hash[:identifier])
@@ -208,4 +193,4 @@ module FromHoneybee
208
193
  end
209
194
 
210
195
  end #WindowConstructionShadeAbridged
211
- end #FromHoneybee
196
+ end #Honeybee
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,24 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
33
-
34
- require 'openstudio'
35
-
32
+ require 'honeybee/construction_set'
36
33
 
37
- module FromHoneybee
38
- class ConstructionSetAbridged < ModelObject
39
- attr_reader :errors, :warnings
34
+ require 'to_openstudio/model_object'
40
35
 
41
- def initialize(hash = {})
42
- super(hash)
43
-
44
- raise "Incorrect model type '#{@type}'" unless @type == 'ConstructionSetAbridged'
45
- end
46
-
47
- def defaults
48
- @@schema[:components][:schemas][:ConstructionSetAbridged][:properties]
49
- end
36
+ module Honeybee
37
+ class ConstructionSetAbridged
50
38
 
51
39
  def find_existing_openstudio_object(openstudio_model)
52
40
  object = openstudio_model.getDefaultConstructionSetByName(@hash[:identifier])
@@ -70,7 +58,7 @@ module FromHoneybee
70
58
  os_constr_set.setDefaultGroundContactSurfaceConstructions(grnd_surf_const)
71
59
  os_constr_set.setDefaultInteriorSubSurfaceConstructions(int_subsurf_const)
72
60
  os_constr_set.setDefaultExteriorSubSurfaceConstructions(ext_subsurf_const)
73
-
61
+
74
62
  # assign any constructions in the wall set
75
63
  if @hash[:wall_set]
76
64
  if @hash[:wall_set][:interior_construction]
@@ -171,7 +159,7 @@ module FromHoneybee
171
159
  ext_subsurf_const.setOperableWindowConstruction(operable_aperture)
172
160
  end
173
161
  end
174
- end
162
+ end
175
163
 
176
164
  # assign any constructions in the door set
177
165
  if @hash[:door_set]
@@ -216,7 +204,7 @@ module FromHoneybee
216
204
  end
217
205
  end
218
206
  end
219
-
207
+
220
208
  # assign any shading constructions to construction set
221
209
  if @hash[:shade_construction]
222
210
  shade_ref = openstudio_model.getConstructionByName(@hash[:shade_construction])
@@ -262,7 +250,7 @@ module FromHoneybee
262
250
  check_constr_type(constr_id, face_type, constr_subset)
263
251
  end
264
252
  end
265
-
253
+
266
254
  # check face type and assign to construction subset
267
255
  def check_constr_type(constr_id, face_type, constr_subset)
268
256
  if face_type == 'Wall'
@@ -275,4 +263,4 @@ module FromHoneybee
275
263
  end
276
264
 
277
265
  end #ConstructionSetAbridged
278
- end #FromHoneybee
266
+ end #Honeybee
@@ -1,7 +1,7 @@
1
1
  # *******************************************************************************
2
- # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
2
+ # Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
3
3
  # Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
4
- #
4
+ #
5
5
  # Redistribution and use in source and binary forms, with or without
6
6
  # modification, are permitted provided that the following conditions are met:
7
7
  #
@@ -29,22 +29,12 @@
29
29
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  # *******************************************************************************
31
31
 
32
- require 'from_honeybee/model_object'
32
+ require 'honeybee/geometry/aperture'
33
33
 
34
- require 'openstudio'
34
+ require 'to_openstudio/model_object'
35
35
 
36
- module FromHoneybee
36
+ module Honeybee
37
37
  class Aperture < ModelObject
38
- attr_reader :errors, :warnings
39
-
40
- def initialize(hash)
41
- super(hash)
42
- raise "Incorrect model type '#{@type}'" unless @type == 'Aperture'
43
- end
44
-
45
- def defaults
46
- @@schema[:components][:schemas][:ApertureEnergyPropertiesAbridged][:properties]
47
- end
48
38
 
49
39
  def find_existing_openstudio_object(openstudio_model)
50
40
  object = openstudio_model.getSubSurfaceByName(@hash[:identifier])
@@ -59,14 +49,14 @@ module FromHoneybee
59
49
  os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
60
50
  end
61
51
  reordered_vertices = OpenStudio.reorderULC(os_vertices)
62
-
52
+
63
53
  # triangulate subsurface if neccesary
64
54
  triangulated = false
65
55
  final_vertices_list = []
66
56
  matching_os_subsurfaces = []
67
57
  matching_os_subsurface_indices = []
68
58
  if reordered_vertices.size > 4
69
-
59
+
70
60
  # if this apeture has a matched apeture, see if the other one has already been created
71
61
  # the matched apeture should have been converted to multiple subsurfaces
72
62
  if @hash[:boundary_condition][:type] == 'Surface'
@@ -80,33 +70,33 @@ module FromHoneybee
80
70
  end
81
71
  end
82
72
  end
83
-
73
+
84
74
  # if other apeture is not already created, do the triangulation
85
75
  if final_vertices_list.empty?
86
-
76
+
87
77
  # transform to face coordinates
88
78
  t = OpenStudio::Transformation::alignFace(reordered_vertices)
89
79
  tInv = t.inverse
90
80
  face_vertices = OpenStudio::reverse(tInv*reordered_vertices)
91
-
81
+
92
82
  # no holes in the subsurface
93
83
  holes = OpenStudio::Point3dVectorVector.new
94
-
84
+
95
85
  # triangulate surface
96
86
  triangles = OpenStudio::computeTriangulation(face_vertices, holes)
97
87
  if triangles.empty?
98
88
  raise "Failed to triangulate aperture #{@hash[:identifier]} with #{reordered_vertices.size} vertices"
99
89
  end
100
-
90
+
101
91
  # create new list of surfaces
102
92
  triangles.each do |vertices|
103
93
  final_vertices_list << OpenStudio.reorderULC(OpenStudio::reverse(t*vertices))
104
94
  end
105
-
95
+
106
96
  triangulated = true
107
-
97
+
108
98
  end
109
-
99
+
110
100
  else
111
101
  # reordered_vertices are good as is
112
102
  final_vertices_list << reordered_vertices
@@ -115,7 +105,7 @@ module FromHoneybee
115
105
  result = []
116
106
  final_vertices_list.each_with_index do |reordered_vertices, index|
117
107
  os_subsurface = OpenStudio::Model::SubSurface.new(reordered_vertices, openstudio_model)
118
-
108
+
119
109
  if !matching_os_subsurfaces.empty?
120
110
  os_subsurface.setName(@hash[:identifier] + "..#{matching_os_subsurface_indices[index]}")
121
111
  elsif triangulated
@@ -123,7 +113,7 @@ module FromHoneybee
123
113
  else
124
114
  os_subsurface.setName(@hash[:identifier])
125
115
  end
126
-
116
+
127
117
  # assign the construction if it exists
128
118
  if @hash[:properties][:energy][:construction]
129
119
  construction_identifier = @hash[:properties][:energy][:construction]
@@ -133,7 +123,7 @@ module FromHoneybee
133
123
  os_subsurface.setConstruction(os_construction)
134
124
  end
135
125
  end
136
-
126
+
137
127
  # assign the boundary condition object if it's a Surface
138
128
  if @hash[:boundary_condition][:type] == 'Surface'
139
129
  if !matching_os_subsurfaces.empty?
@@ -154,14 +144,14 @@ module FromHoneybee
154
144
  # assign the operable property
155
145
  if @hash[:is_operable] == false
156
146
  os_subsurface.setSubSurfaceType('FixedWindow')
157
- else
147
+ else
158
148
  os_subsurface.setSubSurfaceType('OperableWindow')
159
149
  end
160
-
150
+
161
151
  result << os_subsurface
162
152
  end
163
-
153
+
164
154
  return result
165
155
  end
166
156
  end # Aperture
167
- end # FromHoneybee
157
+ end # Honeybee