Class: Honeybee::VentilationOpening
- Inherits:
-
ModelObject
show all
- Defined in:
- lib/honeybee/ventcool/opening.rb,
lib/to_openstudio/ventcool/opening.rb
Instance Attribute Summary
Attributes inherited from ModelObject
#errors, #openstudio_object, #warnings
Instance Method Summary
collapse
Methods inherited from ModelObject
#allowable_types, clean_identifier, clean_name, #find_existing_openstudio_object, #initialize, #method_missing, read_from_disk, truncate
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Honeybee::ModelObject
Instance Method Details
#compute_height(surface) ⇒ Object
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
# File 'lib/to_openstudio/ventcool/opening.rb', line 198
def compute_height(surface)
verts = surface.vertices
min_pt = verts[0].z
max_pt = verts[0].z
verts.each do |v|
if v.z < min_pt
min_pt = v.z
elsif v.z > max_pt
max_pt = v.z
end
end
(max_pt - min_pt) / 4
end
|
#defaults ⇒ Object
37
38
39
|
# File 'lib/honeybee/ventcool/opening.rb', line 37
def defaults
@@schema[:components][:schemas][:VentilationOpening][:properties]
end
|
#defaults_control ⇒ Object
41
42
43
|
# File 'lib/honeybee/ventcool/opening.rb', line 41
def defaults_control
@@schema[:components][:schemas][:VentilationControlAbridged][:properties]
end
|
#to_openstudio(openstudio_model, parent, vent_control_hash) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/to_openstudio/ventcool/opening.rb', line 39
def to_openstudio(openstudio_model, parent, vent_control_hash)
os_opening = OpenStudio::Model::ZoneVentilationWindandStackOpenArea.new(openstudio_model)
os_opening.setName(parent.name.get + '_Opening')
if @hash[:fraction_area_operable]
os_opening.setOpeningArea(@hash[:fraction_area_operable] * parent.netArea)
else
os_opening.setOpeningArea(
defaults[:fraction_area_operable][:default] * parent.netArea)
end
if @hash[:fraction_height_operable]
os_opening. setHeightDifference(
@hash[:fraction_height_operable] * compute_height(parent))
else
os_opening. setHeightDifference(
defaults[:fraction_height_operable][:default] * compute_height(parent))
end
az_degrees = parent.azimuth * 180 / Math::PI
os_opening.setEffectiveAngle(az_degrees.round())
if @hash[:discharge_coefficient]
os_opening.setDischargeCoefficientforOpening(@hash[:discharge_coefficient])
else
os_opening.setDischargeCoefficientforOpening(
defaults[:discharge_coefficient][:default])
end
if @hash[:wind_cross_vent]
os_opening.autocalculateOpeningEffectiveness()
else
os_opening.setOpeningEffectiveness(0)
end
if vent_control_hash
if vent_control_hash[:min_indoor_temperature]
os_opening.setMinimumIndoorTemperature(vent_control_hash[:min_indoor_temperature])
else
os_opening.setMinimumIndoorTemperature(
defaults_control[:min_indoor_temperature][:default])
end
if vent_control_hash[:max_indoor_temperature]
os_opening.setMaximumIndoorTemperature(vent_control_hash[:max_indoor_temperature])
else
os_opening.setMaximumIndoorTemperature(
defaults_control[:max_indoor_temperature][:default])
end
if vent_control_hash[:min_outdoor_temperature]
os_opening.setMinimumOutdoorTemperature(vent_control_hash[:min_outdoor_temperature])
else
os_opening.setMinimumOutdoorTemperature(
defaults_control[:min_outdoor_temperature][:default])
end
if vent_control_hash[:max_outdoor_temperature]
os_opening.setMaximumOutdoorTemperature(vent_control_hash[:max_outdoor_temperature])
else
os_opening.setMaximumOutdoorTemperature(
defaults_control[:max_outdoor_temperature][:default])
end
if vent_control_hash[:delta_temperature]
os_opening.setDeltaTemperature(vent_control_hash[:delta_temperature])
else
os_opening.setDeltaTemperature(
defaults_control[:delta_temperature][:default])
end
if vent_control_hash[:schedule]
vent_sch = openstudio_model.getScheduleByName(vent_control_hash[:schedule])
unless vent_sch.empty?
vent_sch_object = vent_sch.get
os_opening.setOpeningAreaFractionSchedule(vent_sch_object)
end
end
end
os_opening
end
|
#to_openstudio_afn(openstudio_model, parent) ⇒ Object
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
# File 'lib/to_openstudio/ventcool/opening.rb', line 130
def to_openstudio_afn(openstudio_model, parent)
srf_tilt = parent.tilt.to_f * (180 / Math::PI)
srf_bc = parent.outsideBoundaryCondition.to_s
if @hash[:flow_coefficient_closed] and @hash[:flow_coefficient_closed] != 0
flow_coefficient = @hash[:flow_coefficient_closed]
else
flow_coefficient = 1.0e-09 end
flow_exponent = defaults[:flow_exponent_closed][:default].to_f
if @hash[:fraction_area_operable]
open_fac = @hash[:fraction_area_operable]
else
open_fac = defaults[:fraction_area_operable][:default]
end
if srf_tilt < 10 || srf_tilt > 170
if srf_bc == 'Outdoors'
open_fac = nil
os_opening = OpenStudio::Model::AirflowNetworkCrack.new(
openstudio_model, flow_coefficient, flow_exponent, $afn_reference_crack)
else
discharge_coeff = defaults[:discharge_coefficient][:default].to_f
if srf_tilt < 10
slope_ang = 90 - srf_tilt
else
slope_ang = 90 - (180 - srf_tilt)
end
os_opening = OpenStudio::Model::AirflowNetworkHorizontalOpening.new(
openstudio_model, flow_coefficient, flow_exponent, slope_ang, discharge_coeff)
end
else
two_way_thresh = defaults[:two_way_threshold][:default].to_f
discharge_coeff = defaults[:discharge_coefficient][:default].to_f
os_opening = OpenStudio::Model::AirflowNetworkSimpleOpening.new(
openstudio_model, flow_coefficient, flow_exponent, two_way_thresh, discharge_coeff)
if @hash[:flow_exponent_closed]
os_opening.setAirMassFlowExponentWhenOpeningisClosed(@hash[:flow_exponent_closed])
end
if @hash[:two_way_threshold]
os_opening.setMinimumDensityDifferenceforTwoWayFlow(@hash[:two_way_threshold])
end
if @hash[:discharge_coefficient]
os_opening.setDischargeCoefficient(@hash[:discharge_coefficient])
end
end
os_afn_srf = parent.getAirflowNetworkSurface(os_opening)
unless open_fac.nil?
os_afn_srf.setWindowDoorOpeningFactorOrCrackFactor(open_fac)
end
open_fac
end
|