honeybee-openstudio 2.21.1 → 2.22.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -128,43 +128,69 @@ module Honeybee
128
128
  end
129
129
 
130
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
131
+ # get the tilt and BC of the parent so that we can use the correct AFN object
132
+ srf_tilt = parent.tilt.to_f * (180 / Math::PI)
133
+ srf_bc = parent.outsideBoundaryCondition.to_s
134
+
135
+ # process the flow_coefficient_closed and flow exponent
132
136
  if @hash[:flow_coefficient_closed] and @hash[:flow_coefficient_closed] != 0
133
137
  flow_coefficient = @hash[:flow_coefficient_closed]
134
138
  else
135
139
  flow_coefficient = 1.0e-09 # set it to a very small number
136
140
  end
137
-
138
- # create the simple opening object for the Aperture or Door using default values
139
141
  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
142
 
161
- # assign the opening area
143
+ # process the opening area
162
144
  if @hash[:fraction_area_operable]
163
145
  open_fac = @hash[:fraction_area_operable]
164
146
  else
165
147
  open_fac = defaults[:fraction_area_operable][:default]
166
148
  end
167
- os_afn_srf.setWindowDoorOpeningFactorOrCrackFactor(open_fac)
149
+
150
+ # create an opening obj
151
+ if srf_tilt < 10 || srf_tilt > 170
152
+ if srf_bc == 'Outdoors'
153
+ # create a crack object to represent an exterior in-operable horizontal skylight
154
+ open_fac = nil
155
+ os_opening = OpenStudio::Model::AirflowNetworkCrack.new(
156
+ openstudio_model, flow_coefficient, flow_exponent, $afn_reference_crack)
157
+ else
158
+ # create a HorizontalOpening object to represent the interior horizontal window
159
+ discharge_coeff = defaults[:discharge_coefficient][:default].to_f
160
+ if srf_tilt < 10
161
+ slope_ang = 90 - srf_tilt
162
+ else
163
+ slope_ang = 90 - (180 - srf_tilt)
164
+ end
165
+ os_opening = OpenStudio::Model::AirflowNetworkHorizontalOpening .new(
166
+ openstudio_model, flow_coefficient, flow_exponent, slope_ang, discharge_coeff)
167
+ end
168
+ else
169
+ # create the simple opening object for the Aperture or Door using default values
170
+ two_way_thresh = defaults[:two_way_threshold][:default].to_f
171
+ discharge_coeff = defaults[:discharge_coefficient][:default].to_f
172
+ os_opening = OpenStudio::Model::AirflowNetworkSimpleOpening.new(
173
+ openstudio_model, flow_coefficient, flow_exponent, two_way_thresh, discharge_coeff)
174
+
175
+ # assign the flow exponent when the opening is closed
176
+ if @hash[:flow_exponent_closed]
177
+ os_opening.setAirMassFlowExponentWhenOpeningisClosed(@hash[:flow_exponent_closed])
178
+ end
179
+ # assign the minimum difference for two-way flow
180
+ if @hash[:two_way_threshold]
181
+ os_opening.setMinimumDensityDifferenceforTwoWayFlow(@hash[:two_way_threshold])
182
+ end
183
+ # assign the discharge coefficient
184
+ if @hash[:discharge_coefficient]
185
+ os_opening.setDischargeCoefficient(@hash[:discharge_coefficient])
186
+ end
187
+ end
188
+
189
+ # create the AirflowNetworkSurface and assign the opening factor
190
+ os_afn_srf = parent.getAirflowNetworkSurface(os_opening)
191
+ unless open_fac.nil?
192
+ os_afn_srf.setWindowDoorOpeningFactorOrCrackFactor(open_fac)
193
+ end
168
194
 
169
195
  open_fac
170
196
  end
data/lib/to_openstudio.rb CHANGED
@@ -53,6 +53,7 @@ require 'to_openstudio/hvac/template'
53
53
  require 'to_openstudio/construction/opaque'
54
54
  require 'to_openstudio/construction/window'
55
55
  require 'to_openstudio/construction/windowshade'
56
+ require 'to_openstudio/construction/dynamic'
56
57
  require 'to_openstudio/construction/shade'
57
58
  require 'to_openstudio/construction/air'
58
59
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybee-openstudio
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.1
4
+ version: 2.22.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2021-07-27 00:00:00.000000000 Z
14
+ date: 2021-09-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -89,14 +89,14 @@ dependencies:
89
89
  requirements:
90
90
  - - "~>"
91
91
  - !ruby/object:Gem::Version
92
- version: 0.54.0
92
+ version: 1.15.0
93
93
  type: :development
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
97
  - - "~>"
98
98
  - !ruby/object:Gem::Version
99
- version: 0.54.0
99
+ version: 1.15.0
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: json_pure
102
102
  requirement: !ruby/object:Gem::Requirement
@@ -117,28 +117,28 @@ dependencies:
117
117
  requirements:
118
118
  - - '='
119
119
  - !ruby/object:Gem::Version
120
- version: 0.4.2
120
+ version: 0.4.3
121
121
  type: :runtime
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
125
  - - '='
126
126
  - !ruby/object:Gem::Version
127
- version: 0.4.2
127
+ version: 0.4.3
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: openstudio-standards
130
130
  requirement: !ruby/object:Gem::Requirement
131
131
  requirements:
132
132
  - - "~>"
133
133
  - !ruby/object:Gem::Version
134
- version: 0.2.13
134
+ version: 0.2.14
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
139
  - - "~>"
140
140
  - !ruby/object:Gem::Version
141
- version: 0.2.13
141
+ version: 0.2.14
142
142
  description: Library and measures for translating between Honeybee JSON schema and
143
143
  OpenStudio Model schema (OSM).
144
144
  email:
@@ -195,6 +195,7 @@ files:
195
195
  - lib/honeybee/_defaults/model.json
196
196
  - lib/honeybee/_defaults/simulation-parameter.json
197
197
  - lib/honeybee/construction/air.rb
198
+ - lib/honeybee/construction/dynamic.rb
198
199
  - lib/honeybee/construction/opaque.rb
199
200
  - lib/honeybee/construction/shade.rb
200
201
  - lib/honeybee/construction/window.rb
@@ -273,6 +274,7 @@ files:
273
274
  - lib/measures/from_openstudio_model/tests/from_openstudio_model_test.rb
274
275
  - lib/to_openstudio.rb
275
276
  - lib/to_openstudio/construction/air.rb
277
+ - lib/to_openstudio/construction/dynamic.rb
276
278
  - lib/to_openstudio/construction/opaque.rb
277
279
  - lib/to_openstudio/construction/shade.rb
278
280
  - lib/to_openstudio/construction/window.rb