honeybee-openstudio 0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (132) hide show
  1. checksums.yaml +5 -5
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +32 -33
  4. data/.releaserc.json +7 -7
  5. data/.travis.yml +41 -0
  6. data/Gemfile +18 -14
  7. data/LICENSE.md +23 -23
  8. data/README.md +95 -95
  9. data/Rakefile +21 -16
  10. data/doc_templates/LICENSE.md +23 -23
  11. data/doc_templates/copyright_erb.txt +31 -31
  12. data/doc_templates/copyright_js.txt +4 -4
  13. data/doc_templates/copyright_ruby.txt +29 -29
  14. data/honeybee-openstudio.gemspec +35 -38
  15. data/lib/files/Honeybee.rb +112 -112
  16. data/lib/files/honeybee_workflow.osw +47 -47
  17. data/lib/files/urbanopt_Gemfile +32 -32
  18. data/lib/{honeybee/_defaults → from_honeybee/_openapi}/model.json +8126 -11310
  19. data/lib/{honeybee/_defaults → from_honeybee/_openapi}/simulation-parameter.json +842 -972
  20. data/lib/{to_openstudio → from_honeybee}/construction/air.rb +65 -56
  21. data/lib/{to_openstudio → from_honeybee}/construction/opaque.rb +77 -67
  22. data/lib/{to_openstudio → from_honeybee}/construction/shade.rb +108 -99
  23. data/lib/{to_openstudio → from_honeybee}/construction/window.rb +80 -70
  24. data/lib/{to_openstudio → from_honeybee}/construction_set.rb +278 -266
  25. data/lib/{honeybee → from_honeybee}/extension.rb +109 -129
  26. data/lib/{to_openstudio → from_honeybee}/geometry/aperture.rb +167 -157
  27. data/lib/{to_openstudio → from_honeybee}/geometry/door.rb +160 -150
  28. data/lib/{to_openstudio → from_honeybee}/geometry/face.rb +163 -178
  29. data/lib/{to_openstudio → from_honeybee}/geometry/room.rb +392 -442
  30. data/lib/{to_openstudio → from_honeybee}/geometry/shade.rb +89 -79
  31. data/lib/{to_openstudio → from_honeybee}/hvac/ideal_air.rb +150 -141
  32. data/lib/{to_openstudio → from_honeybee}/load/electric_equipment.rb +96 -87
  33. data/lib/{to_openstudio → from_honeybee}/load/gas_equipment.rb +97 -88
  34. data/lib/{to_openstudio → from_honeybee}/load/infiltration.rb +94 -85
  35. data/lib/{to_openstudio → from_honeybee}/load/lighting.rb +98 -89
  36. data/lib/{to_openstudio → from_honeybee}/load/people.rb +100 -91
  37. data/lib/{to_openstudio → from_honeybee}/load/setpoint_humidistat.rb +75 -66
  38. data/lib/{to_openstudio → from_honeybee}/load/setpoint_thermostat.rb +71 -62
  39. data/lib/{to_openstudio → from_honeybee}/load/ventilation.rb +96 -87
  40. data/lib/{to_openstudio → from_honeybee}/material/opaque.rb +94 -85
  41. data/lib/{to_openstudio → from_honeybee}/material/opaque_no_mass.rb +94 -85
  42. data/lib/{to_openstudio → from_honeybee}/material/window_blind.rb +238 -229
  43. data/lib/{to_openstudio → from_honeybee}/material/window_gas.rb +76 -67
  44. data/lib/{to_openstudio → from_honeybee}/material/window_gas_custom.rb +118 -108
  45. data/lib/{to_openstudio → from_honeybee}/material/window_gas_mixture.rb +79 -70
  46. data/lib/{to_openstudio → from_honeybee}/material/window_glazing.rb +166 -157
  47. data/lib/{to_openstudio → from_honeybee}/material/window_shade.rb +160 -151
  48. data/lib/{to_openstudio → from_honeybee}/material/window_simpleglazsys.rb +73 -64
  49. data/lib/from_honeybee/model.rb +434 -0
  50. data/lib/{honeybee → from_honeybee}/model_object.rb +110 -108
  51. data/lib/{to_openstudio → from_honeybee}/program_type.rb +124 -104
  52. data/lib/{to_openstudio → from_honeybee}/schedule/fixed_interval.rb +115 -105
  53. data/lib/{to_openstudio → from_honeybee}/schedule/ruleset.rb +164 -164
  54. data/lib/{to_openstudio → from_honeybee}/schedule/type_limit.rb +88 -76
  55. data/lib/{to_openstudio/simulation/design_day.rb → from_honeybee/simulation/designday.rb} +105 -96
  56. data/lib/{honeybee/load/lighting.rb → from_honeybee/simulation/extension.rb} +46 -43
  57. data/lib/{to_openstudio/simulation/parameter_model.rb → from_honeybee/simulation/parameter.rb} +277 -243
  58. data/lib/{honeybee/simulation/design_day.rb → from_honeybee/version.rb} +34 -42
  59. data/lib/{honeybee.rb → from_honeybee.rb} +86 -93
  60. data/lib/measures/from_honeybee_model/LICENSE.md +27 -23
  61. data/lib/measures/from_honeybee_model/README.md +32 -32
  62. data/lib/measures/from_honeybee_model/measure.rb +91 -91
  63. data/lib/measures/from_honeybee_model/measure.xml +103 -80
  64. data/lib/measures/from_honeybee_model/tests/from_honeybee_model_test.rb +126 -126
  65. data/lib/measures/from_honeybee_simulation_parameter/LICENSE.md +27 -23
  66. data/lib/measures/from_honeybee_simulation_parameter/README.md +32 -32
  67. data/lib/measures/from_honeybee_simulation_parameter/measure.rb +95 -95
  68. data/lib/measures/from_honeybee_simulation_parameter/measure.xml +91 -86
  69. data/lib/measures/from_honeybee_simulation_parameter/tests/from_honeybee_simulation_parameter_test.rb +109 -109
  70. metadata +89 -147
  71. data/.github/workflows/ci.yaml +0 -88
  72. data/doc_templates/README.md.erb +0 -42
  73. data/lib/from_openstudio/geometry/aperture.rb +0 -136
  74. data/lib/from_openstudio/geometry/door.rb +0 -136
  75. data/lib/from_openstudio/geometry/face.rb +0 -174
  76. data/lib/from_openstudio/geometry/room.rb +0 -121
  77. data/lib/from_openstudio/geometry/shade.rb +0 -87
  78. data/lib/from_openstudio/model.rb +0 -123
  79. data/lib/from_openstudio/model_object.rb +0 -43
  80. data/lib/from_openstudio/simulation/design_day.rb +0 -123
  81. data/lib/from_openstudio/simulation/parameter_model.rb +0 -93
  82. data/lib/from_openstudio/simulation/simulation_output.rb +0 -67
  83. data/lib/from_openstudio.rb +0 -49
  84. data/lib/honeybee/_defaults/energy_default.json +0 -1682
  85. data/lib/honeybee/construction/air.rb +0 -42
  86. data/lib/honeybee/construction/opaque.rb +0 -42
  87. data/lib/honeybee/construction/shade.rb +0 -42
  88. data/lib/honeybee/construction/window.rb +0 -51
  89. data/lib/honeybee/construction/windowshade.rb +0 -43
  90. data/lib/honeybee/construction_set.rb +0 -42
  91. data/lib/honeybee/geometry/aperture.rb +0 -42
  92. data/lib/honeybee/geometry/door.rb +0 -42
  93. data/lib/honeybee/geometry/face.rb +0 -48
  94. data/lib/honeybee/geometry/room.rb +0 -56
  95. data/lib/honeybee/geometry/shade.rb +0 -42
  96. data/lib/honeybee/hvac/ideal_air.rb +0 -42
  97. data/lib/honeybee/hvac/template.rb +0 -73
  98. data/lib/honeybee/load/electric_equipment.rb +0 -42
  99. data/lib/honeybee/load/gas_equipment.rb +0 -42
  100. data/lib/honeybee/load/infiltration.rb +0 -42
  101. data/lib/honeybee/load/people.rb +0 -42
  102. data/lib/honeybee/load/setpoint_humidistat.rb +0 -46
  103. data/lib/honeybee/load/setpoint_thermostat.rb +0 -46
  104. data/lib/honeybee/load/ventilation.rb +0 -42
  105. data/lib/honeybee/material/opaque.rb +0 -42
  106. data/lib/honeybee/material/opaque_no_mass.rb +0 -42
  107. data/lib/honeybee/material/window_blind.rb +0 -42
  108. data/lib/honeybee/material/window_gas.rb +0 -42
  109. data/lib/honeybee/material/window_gas_custom.rb +0 -42
  110. data/lib/honeybee/material/window_gas_mixture.rb +0 -42
  111. data/lib/honeybee/material/window_glazing.rb +0 -42
  112. data/lib/honeybee/material/window_shade.rb +0 -42
  113. data/lib/honeybee/material/window_simpleglazsys.rb +0 -42
  114. data/lib/honeybee/model.rb +0 -87
  115. data/lib/honeybee/program_type.rb +0 -56
  116. data/lib/honeybee/schedule/fixed_interval.rb +0 -42
  117. data/lib/honeybee/schedule/ruleset.rb +0 -42
  118. data/lib/honeybee/schedule/type_limit.rb +0 -42
  119. data/lib/honeybee/simulation/parameter_model.rb +0 -86
  120. data/lib/honeybee/simulation/simulation_output.rb +0 -42
  121. data/lib/honeybee/ventcool/control.rb +0 -42
  122. data/lib/honeybee/ventcool/opening.rb +0 -46
  123. data/lib/honeybee/ventcool/simulation.rb +0 -42
  124. data/lib/to_openstudio/construction/windowshade.rb +0 -196
  125. data/lib/to_openstudio/hvac/Model.hvac.rb +0 -641
  126. data/lib/to_openstudio/hvac/template.rb +0 -169
  127. data/lib/to_openstudio/model.rb +0 -497
  128. data/lib/to_openstudio/model_object.rb +0 -52
  129. data/lib/to_openstudio/ventcool/control.rb +0 -185
  130. data/lib/to_openstudio/ventcool/opening.rb +0 -189
  131. data/lib/to_openstudio/ventcool/simulation.rb +0 -101
  132. data/lib/to_openstudio.rb +0 -92
@@ -1,52 +0,0 @@
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
- require 'openstudio'
35
-
36
- module Honeybee
37
- class ModelObject
38
-
39
- attr_reader :openstudio_object
40
-
41
- # find an equivalent existing object in the openstudio model, return nil if not found
42
- def find_existing_openstudio_object(openstudio_model)
43
- raise 'find_existing_openstudio_object is not yet implemented for this ModelObject.'
44
- end
45
-
46
- # create a new object in the openstudio model and return it
47
- def to_openstudio(openstudio_model)
48
- raise 'to_openstudio is not yet implemented for this ModelObject.'
49
- end
50
-
51
- end # ModelObject
52
- end # Honeybee
@@ -1,185 +0,0 @@
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/ventcool/opening'
33
-
34
- require 'to_openstudio/model_object'
35
-
36
- module Honeybee
37
- class VentilationControlAbridged
38
- @@outdoor_node = nil
39
- @@program_manager = nil
40
- @@sensor_count = 1
41
- @@actuator_count = 1
42
- @@program_count = 1
43
-
44
- def get_outdoor_node(openstudio_model)
45
- # get the EMS sensor for the outdoor node if it exists or generate it if it doesn't
46
- if @@outdoor_node.nil?
47
- out_var = OpenStudio::Model::OutputVariable.new(
48
- 'Site Outdoor Air Drybulb Temperature', openstudio_model)
49
- out_var.setReportingFrequency('Timestep')
50
- out_var.setKeyValue('Environment')
51
- @@outdoor_node = OpenStudio::Model::EnergyManagementSystemSensor.new(
52
- openstudio_model, out_var)
53
- @@outdoor_node.setName('Outdoor_Sensor')
54
- end
55
- @@outdoor_node
56
- end
57
-
58
- def get_program_manager(openstudio_model)
59
- # get the EMS Program Manager for all window opening if it exists or generate it if it doesn't
60
- if @@program_manager.nil?
61
- @@program_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(
62
- openstudio_model)
63
- @@program_manager.setName('Temperature_Controlled_Window_Opening')
64
- @@program_manager.setCallingPoint('BeginTimestepBeforePredictor')
65
- end
66
- @@program_manager
67
- end
68
-
69
- def replace_ems_special_characters(ems_variable_name)
70
- # remove special characters from an name to be used as an EMS variable
71
- new_name = ems_variable_name.to_s
72
- new_name.gsub!(/[^A-Za-z]/, '')
73
- new_name
74
- end
75
-
76
- def to_openstudio(openstudio_model, parent_zone, vent_opening_surfaces, vent_opening_factors)
77
- # Get the outdoor temperature sensor and the room air temperature sensor
78
- out_air_temp = get_outdoor_node(openstudio_model)
79
- in_var = OpenStudio::Model::OutputVariable.new('Zone Air Temperature', openstudio_model)
80
- in_var.setReportingFrequency('Timestep')
81
- zone_name = parent_zone.name
82
- os_zone_name = 'Indoor'
83
- unless zone_name.empty?
84
- os_zone_name = zone_name.get
85
- in_var.setKeyValue(os_zone_name)
86
- end
87
- in_air_temp = OpenStudio::Model::EnergyManagementSystemSensor.new(openstudio_model, in_var)
88
- in_sensor_name = replace_ems_special_characters(os_zone_name) + '_Sensor' + @@sensor_count.to_s
89
- @@sensor_count = @@sensor_count + 1
90
- in_air_temp.setName(in_sensor_name)
91
-
92
- # set up a schedule sensor if there's a schedule specified
93
- if @hash[:schedule]
94
- vent_sch = openstudio_model.getScheduleByName(@hash[:schedule])
95
- unless vent_sch.empty? # schedule not specified
96
- sch_var = OpenStudio::Model::OutputVariable.new('Schedule Value', openstudio_model)
97
- sch_var.setReportingFrequency('Timestep')
98
- sch_var.setKeyValue(@hash[:schedule])
99
- sch_sens = OpenStudio::Model::EnergyManagementSystemSensor.new(openstudio_model, sch_var)
100
- sch_sensor_name = replace_ems_special_characters(os_zone_name) + '_Sensor' + @@sensor_count.to_s
101
- @@sensor_count = @@sensor_count + 1
102
- sch_sens.setName(sch_sensor_name)
103
- end
104
- end
105
-
106
- # create the actuators for each of the operaable windows
107
- actuator_names = []
108
- vent_opening_surfaces.each do |vent_srf|
109
- window_act = OpenStudio::Model::EnergyManagementSystemActuator.new(
110
- vent_srf, 'AirFlow Network Window/Door Opening', 'Venting Opening Factor')
111
- vent_srf_name = vent_srf.name
112
- unless vent_srf_name.empty?
113
- act_name = replace_ems_special_characters(vent_srf_name.get) + \
114
- '_OpenFactor' + @@actuator_count.to_s
115
- @@actuator_count = @@actuator_count + 1
116
- window_act.setName(act_name)
117
- actuator_names << act_name
118
- end
119
- end
120
-
121
- # create the first line of the EMS Program to open each window according to the control logic
122
- logic_statements = []
123
- # check the minimum indoor tempertaure for ventilation
124
- min_in = @hash[:min_indoor_temperature]
125
- if min_in && min_in != defaults[:min_indoor_temperature][:default]
126
- logic_statements << '(' + in_sensor_name + ' > ' + min_in.to_s + ')'
127
- end
128
- # check the maximum indoor tempertaure for ventilation
129
- max_in = @hash[:max_indoor_temperature]
130
- if max_in && max_in != defaults[:max_indoor_temperature][:default]
131
- logic_statements << '(' + in_sensor_name + ' < ' + max_in.to_s + ')'
132
- end
133
- # check the minimum outdoor tempertaure for ventilation
134
- min_out = @hash[:min_outdoor_temperature]
135
- if min_out && min_out != defaults[:min_outdoor_temperature][:default]
136
- logic_statements << '(Outdoor_Sensor > ' + min_out.to_s + ')'
137
- end
138
- # check the maximum outdoor tempertaure for ventilation
139
- max_out = @hash[:max_outdoor_temperature]
140
- if max_out && max_out != defaults[:max_outdoor_temperature][:default]
141
- logic_statements << '(Outdoor_Sensor < ' + max_out.to_s + ')'
142
- end
143
- # check the delta tempertaure for ventilation
144
- delta_in_out = @hash[:delta_temperature]
145
- if delta_in_out && delta_in_out != defaults[:delta_temperature][:default]
146
- logic_statements << '((' + in_sensor_name + ' - Outdoor_Sensor) > ' + delta_in_out.to_s + ')'
147
- end
148
- # check the schedule for ventilation
149
- if sch_sensor_name
150
- logic_statements << '(' + sch_sensor_name + ' > 0)'
151
- end
152
- # create the complete logic statement for opening windows
153
- if logic_statements.empty?
154
- complete_logic = 'IF (Outdoor_Sensor < 100)' # no logic has been provided; always open windows
155
- else
156
- complete_logic = 'IF ' + logic_statements.join(' && ')
157
- end
158
-
159
- # initialize the program and add the complete logic
160
- ems_program = OpenStudio::Model::EnergyManagementSystemProgram.new(openstudio_model)
161
- prog_name = replace_ems_special_characters(os_zone_name) + '_WindowOpening' + @@program_count.to_s
162
- @@program_count = @@program_count + 1
163
- ems_program.setName(prog_name)
164
- ems_program.addLine(complete_logic)
165
-
166
- # loop through each of the actuators and open each window
167
- actuator_names.zip(vent_opening_factors).each do |act_name, open_factor|
168
- ems_program.addLine('SET ' + act_name + ' = ' + open_factor.to_s)
169
- end
170
- # loop through each of the actuators and close each window
171
- ems_program.addLine('ELSE')
172
- actuator_names.each do |act_name|
173
- ems_program.addLine('SET ' + act_name + ' = 0')
174
- end
175
- ems_program.addLine('ENDIF')
176
-
177
- # add the program object the the global program manager for all window opening
178
- prog_manager = get_program_manager(openstudio_model)
179
- prog_manager.addProgram(ems_program)
180
-
181
- ems_program
182
- end
183
-
184
- end #VentilationControl
185
- end #Honeybee
@@ -1,189 +0,0 @@
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/ventcool/opening'
33
-
34
- require 'to_openstudio/model_object'
35
-
36
- module Honeybee
37
- class VentilationOpening
38
-
39
- def to_openstudio(openstudio_model, parent, vent_control_hash)
40
- # create wind and stack object and set identifier
41
- os_opening = OpenStudio::Model::ZoneVentilationWindandStackOpenArea.new(openstudio_model)
42
- os_opening.setName(parent.name.get + '_Opening')
43
-
44
- # assign the opening area
45
- if @hash[:fraction_area_operable]
46
- os_opening.setOpeningArea(@hash[:fraction_area_operable] * parent.netArea)
47
- else
48
- os_opening.setOpeningArea(
49
- defaults[:fraction_area_operable][:default] * parent.netArea)
50
- end
51
-
52
- # assign the height
53
- if @hash[:fraction_height_operable]
54
- os_opening. setHeightDifference(
55
- @hash[:fraction_height_operable] * compute_height(parent))
56
- else
57
- os_opening. setHeightDifference(
58
- defaults[:fraction_height_operable][:default] * compute_height(parent))
59
- end
60
-
61
- # assign the azimuth
62
- az_degrees = parent.azimuth * 180 / Math::PI
63
- os_opening.setEffectiveAngle(az_degrees.round())
64
-
65
- # assign the discharge coefficient
66
- if @hash[:discharge_coefficient]
67
- os_opening.setDischargeCoefficientforOpening(@hash[:discharge_coefficient])
68
- else
69
- os_opening.setDischargeCoefficientforOpening(
70
- defaults[:discharge_coefficient][:default])
71
- end
72
-
73
- # assign the wind pressure coefficient
74
- if @hash[:wind_cross_vent]
75
- os_opening.autocalculateOpeningEffectiveness()
76
- else
77
- os_opening.setOpeningEffectiveness(0)
78
- end
79
-
80
- # set all of the ventilation control properties
81
- if vent_control_hash
82
- # assign min_indoor_temperature
83
- if vent_control_hash[:min_indoor_temperature]
84
- os_opening.setMinimumIndoorTemperature(vent_control_hash[:min_indoor_temperature])
85
- else
86
- os_opening.setMinimumIndoorTemperature(
87
- defaults_control[:min_indoor_temperature][:default])
88
- end
89
- # assign max_indoor_temperature
90
- if vent_control_hash[:max_indoor_temperature]
91
- os_opening.setMaximumIndoorTemperature(vent_control_hash[:max_indoor_temperature])
92
- else
93
- os_opening.setMaximumIndoorTemperature(
94
- defaults_control[:max_indoor_temperature][:default])
95
- end
96
- # assign min_outdoor_temperature
97
- if vent_control_hash[:min_outdoor_temperature]
98
- os_opening.setMinimumOutdoorTemperature(vent_control_hash[:min_outdoor_temperature])
99
- else
100
- os_opening.setMinimumOutdoorTemperature(
101
- defaults_control[:min_outdoor_temperature][:default])
102
- end
103
- # assign max_outdoor_temperature
104
- if vent_control_hash[:max_outdoor_temperature]
105
- os_opening.setMaximumOutdoorTemperature(vent_control_hash[:max_outdoor_temperature])
106
- else
107
- os_opening.setMaximumOutdoorTemperature(
108
- defaults_control[:max_outdoor_temperature][:default])
109
- end
110
- # assign delta_temperature
111
- if vent_control_hash[:delta_temperature]
112
- os_opening.setDeltaTemperature(vent_control_hash[:delta_temperature])
113
- else
114
- os_opening.setDeltaTemperature(
115
- defaults_control[:delta_temperature][:default])
116
- end
117
- # assign schedule if it exists
118
- if vent_control_hash[:schedule]
119
- vent_sch = openstudio_model.getScheduleByName(vent_control_hash[:schedule])
120
- unless vent_sch.empty?
121
- vent_sch_object = vent_sch.get
122
- os_opening.setOpeningAreaFractionSchedule(vent_sch_object)
123
- end
124
- end
125
- end
126
-
127
- os_opening
128
- end
129
-
130
- def to_openstudio_afn(openstudio_model, parent)
131
- # process the flow_coefficient_closed and set it to a very small number if it's 0
132
- if @hash[:flow_coefficient_closed] and @hash[:flow_coefficient_closed] != 0
133
- flow_coefficient = @hash[:flow_coefficient_closed]
134
- else
135
- flow_coefficient = 1.0e-09 # set it to a very small number
136
- end
137
-
138
- # create the simple opening object for the Aperture or Door using default values
139
- flow_exponent = defaults[:flow_exponent_closed][:default].to_f
140
- two_way_thresh = defaults[:two_way_threshold][:default].to_f
141
- discharge_coeff = defaults[:discharge_coefficient][:default].to_f
142
- os_opening = OpenStudio::Model::AirflowNetworkSimpleOpening.new(
143
- openstudio_model, flow_coefficient, flow_exponent, two_way_thresh, discharge_coeff)
144
-
145
- # assign the flow exponent when the opening is closed
146
- if @hash[:flow_exponent_closed]
147
- os_opening.setAirMassFlowExponentWhenOpeningisClosed(@hash[:flow_exponent_closed])
148
- end
149
- # assign the minimum difference for two-way flow
150
- if @hash[:two_way_threshold]
151
- os_opening.setMinimumDensityDifferenceforTwoWayFlow(@hash[:two_way_threshold])
152
- end
153
- # assign the discharge coefficient
154
- if @hash[:discharge_coefficient]
155
- os_opening.setDischargeCoefficient(@hash[:discharge_coefficient])
156
- end
157
-
158
- # create the AirflowNetworkSurface
159
- os_afn_srf = parent.getAirflowNetworkSurface(os_opening)
160
-
161
- # assign the opening area
162
- if @hash[:fraction_area_operable]
163
- open_fac = @hash[:fraction_area_operable]
164
- else
165
- open_fac = defaults[:fraction_area_operable][:default]
166
- end
167
- os_afn_srf.setWindowDoorOpeningFactorOrCrackFactor(open_fac)
168
-
169
- open_fac
170
- end
171
-
172
- def compute_height(surface)
173
- # derive the height (difference in z values) of a surface
174
- verts = surface.vertices
175
- min_pt = verts[0].z
176
- max_pt = verts[0].z
177
- verts.each do |v|
178
- if v.z < min_pt
179
- min_pt = v.z
180
- elsif v.z > max_pt
181
- max_pt = v.z
182
- end
183
- end
184
- # quarter the window height to get the height from midpoint of lower opening to neutral pressure level
185
- (max_pt - min_pt) / 4
186
- end
187
-
188
- end #VentilationOpening
189
- end #Honeybee
@@ -1,101 +0,0 @@
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/ventcool/simulation'
33
-
34
- require 'to_openstudio/model_object'
35
-
36
- module Honeybee
37
- class VentilationSimulationControl
38
-
39
- def to_openstudio(openstudio_model)
40
- # create the AirflowNetworkSimulationControl object
41
- os_vsim_control = openstudio_model.getAirflowNetworkSimulationControl
42
- os_vsim_control.setName('Window Based Ventilative Cooling')
43
-
44
- # assign the control type
45
- if @hash[:vent_control_type]
46
- os_vsim_control.setAirflowNetworkControl(@hash[:vent_control_type])
47
- else
48
- os_vsim_control.setAirflowNetworkControl('MultizoneWithoutDistribution')
49
- end
50
-
51
- # assign the building type
52
- if @hash[:building_type]
53
- os_vsim_control.setBuildingType(@hash[:building_type])
54
- else
55
- os_vsim_control.setBuildingType(defaults[:building_type][:default])
56
- end
57
-
58
- # assign the long axis azimth angle of the building
59
- if @hash[:long_axis_angle]
60
- os_vsim_control.setAzimuthAngleofLongAxisofBuilding(@hash[:long_axis_angle])
61
- else
62
- os_vsim_control.setAzimuthAngleofLongAxisofBuilding(defaults[:long_axis_angle][:default])
63
- end
64
-
65
- # assign the aspect ratio of the building
66
- if @hash[:aspect_ratio]
67
- os_vsim_control.setBuildingAspectRatio(@hash[:aspect_ratio])
68
- else
69
- os_vsim_control.setBuildingAspectRatio(defaults[:aspect_ratio][:default])
70
- end
71
-
72
- # create the AirflowNetworkReferenceCrackConditions object that all other cracks reference
73
- os_ref_crack = OpenStudio::Model::AirflowNetworkReferenceCrackConditions.new(openstudio_model)
74
- os_ref_crack.setName('Reference Crack Conditions')
75
-
76
- # assign the reference temperature
77
- if @hash[:reference_temperature]
78
- os_ref_crack.setTemperature(@hash[:reference_temperature])
79
- else
80
- os_ref_crack.setTemperature(defaults[:reference_temperature][:default])
81
- end
82
-
83
- # assign the reference pressure
84
- if @hash[:reference_pressure]
85
- os_ref_crack.setBarometricPressure(@hash[:reference_pressure])
86
- else
87
- os_ref_crack.setBarometricPressure(defaults[:reference_pressure][:default])
88
- end
89
-
90
- # assign the reference humidity ratio
91
- if @hash[:reference_humidity_ratio]
92
- os_ref_crack.setHumidityRatio(@hash[:reference_humidity_ratio])
93
- else
94
- os_ref_crack.setHumidityRatio(defaults[:reference_humidity_ratio][:default])
95
- end
96
-
97
- os_ref_crack
98
- end
99
-
100
- end #VentilationSimulationControl
101
- end #Honeybee
data/lib/to_openstudio.rb DELETED
@@ -1,92 +0,0 @@
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
- # import the honeybee objects which we will extend
33
- require 'honeybee'
34
-
35
- # extend the compound objects that house the other objects
36
- require 'to_openstudio/model'
37
- require 'to_openstudio/model_object'
38
- require 'to_openstudio/construction_set'
39
- require 'to_openstudio/program_type'
40
-
41
- # extend the geometry objects
42
- require 'to_openstudio/geometry/shade'
43
- require 'to_openstudio/geometry/door'
44
- require 'to_openstudio/geometry/aperture'
45
- require 'to_openstudio/geometry/face'
46
- require 'to_openstudio/geometry/room'
47
-
48
- # extend the HVAC objects
49
- require 'to_openstudio/hvac/ideal_air'
50
- require 'to_openstudio/hvac/template'
51
-
52
- # extend the construction objects
53
- require 'to_openstudio/construction/opaque'
54
- require 'to_openstudio/construction/window'
55
- require 'to_openstudio/construction/windowshade'
56
- require 'to_openstudio/construction/shade'
57
- require 'to_openstudio/construction/air'
58
-
59
- # extend the material objects
60
- require 'to_openstudio/material/opaque'
61
- require 'to_openstudio/material/opaque_no_mass'
62
- require 'to_openstudio/material/window_gas'
63
- require 'to_openstudio/material/window_gas_mixture'
64
- require 'to_openstudio/material/window_gas_custom'
65
- require 'to_openstudio/material/window_blind'
66
- require 'to_openstudio/material/window_glazing'
67
- require 'to_openstudio/material/window_shade'
68
- require 'to_openstudio/material/window_simpleglazsys'
69
-
70
- # extend the load objects
71
- require 'to_openstudio/load/people'
72
- require 'to_openstudio/load/lighting'
73
- require 'to_openstudio/load/electric_equipment'
74
- require 'to_openstudio/load/gas_equipment'
75
- require 'to_openstudio/load/infiltration'
76
- require 'to_openstudio/load/ventilation'
77
- require 'to_openstudio/load/setpoint_thermostat'
78
- require 'to_openstudio/load/setpoint_humidistat'
79
-
80
- # extend the schedule objects
81
- require 'to_openstudio/schedule/type_limit'
82
- require 'to_openstudio/schedule/fixed_interval'
83
- require 'to_openstudio/schedule/ruleset'
84
-
85
- # import the ventilation objects
86
- require 'to_openstudio/ventcool/control'
87
- require 'to_openstudio/ventcool/opening'
88
- require 'to_openstudio/ventcool/simulation'
89
-
90
- # extend the simulation objects
91
- require 'to_openstudio/simulation/design_day'
92
- require 'to_openstudio/simulation/parameter_model'