tbd 3.2.3 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/pull_request.yml +32 -0
- data/.yardopts +14 -0
- data/README.md +23 -25
- data/json/tbd_warehouse17.json +8 -0
- data/json/tbd_warehouse18.json +12 -0
- data/json/tbd_warehouse4.json +17 -0
- data/lib/measures/tbd/README.md +27 -11
- data/lib/measures/tbd/measure.rb +155 -72
- data/lib/measures/tbd/measure.xml +168 -66
- data/lib/measures/tbd/resources/geo.rb +435 -221
- data/lib/measures/tbd/resources/oslog.rb +213 -161
- data/lib/measures/tbd/resources/psi.rb +1849 -900
- data/lib/measures/tbd/resources/ua.rb +380 -309
- data/lib/measures/tbd/resources/utils.rb +2491 -764
- data/lib/measures/tbd/resources/version.rb +1 -1
- data/lib/measures/tbd/tests/tbd_tests.rb +1 -1
- data/lib/tbd/geo.rb +435 -221
- data/lib/tbd/psi.rb +1849 -900
- data/lib/tbd/ua.rb +380 -309
- data/lib/tbd/version.rb +1 -1
- data/lib/tbd.rb +14 -34
- data/tbd.gemspec +2 -2
- data/tbd.schema.json +189 -20
- data/v291_MacOS.md +2 -4
- metadata +10 -6
data/lib/measures/tbd/measure.rb
CHANGED
@@ -23,24 +23,42 @@
|
|
23
23
|
require_relative "resources/tbd"
|
24
24
|
|
25
25
|
class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
26
|
+
##
|
27
|
+
# Returns TBD Measure identifier.
|
28
|
+
#
|
29
|
+
# @return [String] TBD Measure identifier
|
26
30
|
def name
|
27
31
|
return "Thermal Bridging and Derating - TBD"
|
28
32
|
end
|
29
33
|
|
34
|
+
##
|
35
|
+
# Returns TBD Measure description.
|
36
|
+
#
|
37
|
+
# @return [String] TBD Measure description
|
30
38
|
def description
|
31
39
|
return "Derates opaque constructions from major thermal bridges."
|
32
40
|
end
|
33
41
|
|
42
|
+
##
|
43
|
+
# Returns TBD Measure modeler description.
|
44
|
+
#
|
45
|
+
# @return [String] TBD Measure modeler description
|
34
46
|
def modeler_description
|
35
47
|
return "Check out rd2.github.io/tbd"
|
36
48
|
end
|
37
49
|
|
50
|
+
##
|
51
|
+
# Returns processed/validated TBD Measure arguments.
|
52
|
+
#
|
53
|
+
# @param model [OpenStudio::Model::Model] a model
|
54
|
+
#
|
55
|
+
# @return [OpenStudio::Measure::OSArgumentVector] validated arguments
|
38
56
|
def arguments(model = nil)
|
39
57
|
args = OpenStudio::Measure::OSArgumentVector.new
|
40
58
|
|
41
59
|
arg = "alter_model"
|
42
|
-
dsc = "For EnergyPlus simulations, leave CHECKED. For iterative "
|
43
|
-
"exploration with Apply Measures Now, UNCHECK to preserve "
|
60
|
+
dsc = "For EnergyPlus simulations, leave CHECKED. For iterative "\
|
61
|
+
"exploration with Apply Measures Now, UNCHECK to preserve "\
|
44
62
|
"original OpenStudio model."
|
45
63
|
alter = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
46
64
|
alter.setDisplayName("Alter OpenStudio model (Apply Measures Now)")
|
@@ -48,17 +66,8 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
48
66
|
alter.setDefaultValue(true)
|
49
67
|
args << alter
|
50
68
|
|
51
|
-
arg = "sub_tol"
|
52
|
-
dsc = "Proximity tolerance (e.g. 0.100 m) between subsurface edges, e.g. " \
|
53
|
-
"between near-adjacent window jambs."
|
54
|
-
sub_tol = OpenStudio::Measure::OSArgument.makeDoubleArgument(arg, false)
|
55
|
-
sub_tol.setDisplayName("Proximity tolerance (m)")
|
56
|
-
sub_tol.setDescription(dsc)
|
57
|
-
sub_tol.setDefaultValue(TBD::TOL)
|
58
|
-
args << sub_tol
|
59
|
-
|
60
69
|
arg = "load_tbd_json"
|
61
|
-
dsc = "Loads existing 'tbd.json' file (under '/files'), may override "
|
70
|
+
dsc = "Loads existing 'tbd.json' file (under '/files'), may override "\
|
62
71
|
"'default thermal bridge' set."
|
63
72
|
load_tbd = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
64
73
|
load_tbd.setDisplayName("Load 'tbd.json'")
|
@@ -71,7 +80,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
71
80
|
psi.set.keys.each { |k| chs << k.to_s }
|
72
81
|
|
73
82
|
arg = "option"
|
74
|
-
dsc = "e.g. '
|
83
|
+
dsc = "e.g. '90.1.22|steel.m|unmitigated' (may be overridden by "\
|
75
84
|
"'tbd.json' file)."
|
76
85
|
option = OpenStudio::Measure::OSArgument.makeChoiceArgument(arg, chs, false)
|
77
86
|
option.setDisplayName("Default thermal bridge set")
|
@@ -80,7 +89,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
80
89
|
args << option
|
81
90
|
|
82
91
|
arg = "write_tbd_json"
|
83
|
-
dsc = "Write out 'tbd.out.json' file e.g
|
92
|
+
dsc = "Write out 'tbd.out.json' file, e.g. to customize for subsequent "\
|
84
93
|
"runs (edit, and place under '/files' as 'tbd.json')."
|
85
94
|
write_tbd = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
86
95
|
write_tbd.setDisplayName("Write 'tbd.out.json'")
|
@@ -88,19 +97,33 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
88
97
|
write_tbd.setDefaultValue(false)
|
89
98
|
args << write_tbd
|
90
99
|
|
100
|
+
arg = "parapet"
|
101
|
+
dsc = "Leave CHECKED if wall-roof edge is considered a parapet or an "\
|
102
|
+
"overhang (see ASHRAE 90.1 2022 5.5.5.1 & A10)."
|
103
|
+
parapet = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
104
|
+
parapet.setDisplayName("Wall-roof edge as 'parapet'")
|
105
|
+
parapet.setDescription(dsc)
|
106
|
+
parapet.setDefaultValue(true)
|
107
|
+
args << parapet
|
108
|
+
|
91
109
|
none = "NONE"
|
110
|
+
|
92
111
|
all_walls = "ALL wall constructions"
|
93
112
|
all_roofs = "ALL roof constructions"
|
94
113
|
all_flors = "ALL floor constructions"
|
114
|
+
|
95
115
|
walls = {c: {}}
|
96
116
|
roofs = {c: {}}
|
97
117
|
flors = {c: {}}
|
118
|
+
|
98
119
|
walls[:c][none] = {a: 0}
|
99
120
|
roofs[:c][none] = {a: 0}
|
100
121
|
flors[:c][none] = {a: 0}
|
122
|
+
|
101
123
|
walls[:c][all_walls] = {a: 100000000000000}
|
102
124
|
roofs[:c][all_roofs] = {a: 100000000000000}
|
103
125
|
flors[:c][all_flors] = {a: 100000000000000}
|
126
|
+
|
104
127
|
walls[:chx] = OpenStudio::StringVector.new
|
105
128
|
roofs[:chx] = OpenStudio::StringVector.new
|
106
129
|
flors[:chx] = OpenStudio::StringVector.new
|
@@ -108,17 +131,21 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
108
131
|
if model
|
109
132
|
model.getSurfaces.each do |s|
|
110
133
|
type = s.surfaceType.downcase
|
111
|
-
next unless
|
134
|
+
next unless ["wall", "roofceiling", "floor"].include?(type)
|
112
135
|
next unless s.outsideBoundaryCondition.downcase == "outdoors"
|
113
|
-
next
|
114
|
-
next
|
136
|
+
next if s.construction.empty?
|
137
|
+
next if s.construction.get.to_LayeredConstruction.empty?
|
138
|
+
|
115
139
|
lc = s.construction.get.to_LayeredConstruction.get
|
116
140
|
next if walls[:c].key?(lc.nameString)
|
117
141
|
next if roofs[:c].key?(lc.nameString)
|
118
142
|
next if flors[:c].key?(lc.nameString)
|
119
|
-
|
120
|
-
|
121
|
-
|
143
|
+
|
144
|
+
case type
|
145
|
+
when "wall" then walls[:c][lc.nameString] = {a: lc.getNetArea}
|
146
|
+
when "roofceiling" then roofs[:c][lc.nameString] = {a: lc.getNetArea}
|
147
|
+
else flors[:c][lc.nameString] = {a: lc.getNetArea}
|
148
|
+
end
|
122
149
|
end
|
123
150
|
|
124
151
|
walls[:c] = walls[:c].sort_by{ |k,v| v[:a] }.reverse!.to_h
|
@@ -135,7 +162,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
135
162
|
end
|
136
163
|
|
137
164
|
arg = "wall_option"
|
138
|
-
dsc = "Target 1x (or 'ALL') wall construction(s) to 'uprate', to achieve "
|
165
|
+
dsc = "Target 1x (or 'ALL') wall construction(s) to 'uprate', to achieve "\
|
139
166
|
"wall Ut target below."
|
140
167
|
chx = walls[:chx]
|
141
168
|
wall = OpenStudio::Measure::OSArgument.makeChoiceArgument(arg, chx, false)
|
@@ -145,7 +172,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
145
172
|
args << wall
|
146
173
|
|
147
174
|
arg = "roof_option"
|
148
|
-
dsc = "Target 1x (or 'ALL') roof construction(s) to 'uprate', to achieve "
|
175
|
+
dsc = "Target 1x (or 'ALL') roof construction(s) to 'uprate', to achieve "\
|
149
176
|
"roof Ut target below."
|
150
177
|
chx = roofs[:chx]
|
151
178
|
roof = OpenStudio::Measure::OSArgument.makeChoiceArgument(arg, chx, false)
|
@@ -155,8 +182,8 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
155
182
|
args << roof
|
156
183
|
|
157
184
|
arg = "floor_option"
|
158
|
-
dsc = "Target 1x (or 'ALL') floor construction(s) to 'uprate', to
|
159
|
-
"floor Ut target below."
|
185
|
+
dsc = "Target 1x (or 'ALL') floor construction(s) to 'uprate', to"\
|
186
|
+
"achieve floor Ut target below."
|
160
187
|
chx = flors[:chx]
|
161
188
|
floor = OpenStudio::Measure::OSArgument.makeChoiceArgument(arg, chx, false)
|
162
189
|
floor.setDisplayName("Floor construction(s) to 'uprate'")
|
@@ -165,7 +192,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
165
192
|
args << floor
|
166
193
|
|
167
194
|
arg = "wall_ut"
|
168
|
-
dsc = "Overall Ut target to meet for wall construction(s). Ignored if "
|
195
|
+
dsc = "Overall Ut target to meet for wall construction(s). Ignored if "\
|
169
196
|
"previous wall 'uprate' option is set to 'NONE'."
|
170
197
|
wall_ut = OpenStudio::Measure::OSArgument.makeDoubleArgument(arg, false)
|
171
198
|
wall_ut.setDisplayName("Wall Ut target (W/m2•K)")
|
@@ -174,7 +201,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
174
201
|
args << wall_ut
|
175
202
|
|
176
203
|
arg = "roof_ut"
|
177
|
-
dsc = "Overall Ut target to meet for roof construction(s). Ignored if "
|
204
|
+
dsc = "Overall Ut target to meet for roof construction(s). Ignored if "\
|
178
205
|
"previous roof 'uprate' option is set to 'NONE'."
|
179
206
|
roof_ut = OpenStudio::Measure::OSArgument.makeDoubleArgument(arg, false)
|
180
207
|
roof_ut.setDisplayName("Roof Ut target (W/m2•K)")
|
@@ -183,7 +210,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
183
210
|
args << roof_ut
|
184
211
|
|
185
212
|
arg = "floor_ut"
|
186
|
-
dsc = "Overall Ut target to meet for floor construction(s). Ignored if "
|
213
|
+
dsc = "Overall Ut target to meet for floor construction(s). Ignored if "\
|
187
214
|
"previous floor 'uprate' option is set to 'NONE'."
|
188
215
|
floor_ut = OpenStudio::Measure::OSArgument.makeDoubleArgument(arg, false)
|
189
216
|
floor_ut.setDisplayName("Floor Ut target (W/m2•K)")
|
@@ -192,7 +219,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
192
219
|
args << floor_ut
|
193
220
|
|
194
221
|
arg = "gen_UA_report"
|
195
|
-
dsc = "Compare ∑U•A + ∑PSI•L + ∑KHI•n : 'Design' vs UA' reference (see "
|
222
|
+
dsc = "Compare ∑U•A + ∑PSI•L + ∑KHI•n : 'Design' vs UA' reference (see "\
|
196
223
|
"pull-down option below)."
|
197
224
|
gen_ua_report = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
198
225
|
gen_ua_report.setDisplayName("Generate UA' report")
|
@@ -209,7 +236,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
209
236
|
args << ua_ref
|
210
237
|
|
211
238
|
arg = "gen_kiva"
|
212
|
-
dsc = "Generates Kiva settings & objects for surfaces with 'foundation' "
|
239
|
+
dsc = "Generates Kiva settings & objects for surfaces with 'foundation' "\
|
213
240
|
"boundary conditions (not 'ground')."
|
214
241
|
gen_kiva = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
215
242
|
gen_kiva.setDisplayName("Generate Kiva inputs")
|
@@ -218,7 +245,7 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
218
245
|
args << gen_kiva
|
219
246
|
|
220
247
|
arg = "gen_kiva_force"
|
221
|
-
dsc = "Overwrites 'ground' boundary conditions as 'foundation' before "
|
248
|
+
dsc = "Overwrites 'ground' boundary conditions as 'foundation' before "\
|
222
249
|
"generating Kiva inputs (recommended)."
|
223
250
|
kiva_force = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
224
251
|
kiva_force.setDisplayName("Force-generate Kiva inputs")
|
@@ -226,28 +253,72 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
226
253
|
kiva_force.setDefaultValue(false)
|
227
254
|
args << kiva_force
|
228
255
|
|
229
|
-
|
256
|
+
arg = "reset_kiva"
|
257
|
+
dsc = "Purges KIVA entries from model before generating Kiva inputs."
|
258
|
+
reset_kiva = OpenStudio::Measure::OSArgument.makeBoolArgument(arg, false)
|
259
|
+
reset_kiva.setDisplayName("Purge existing KIVA inputs")
|
260
|
+
reset_kiva.setDescription(dsc)
|
261
|
+
reset_kiva.setDefaultValue(false)
|
262
|
+
args << reset_kiva
|
263
|
+
|
264
|
+
arg = "sub_tol"
|
265
|
+
dsc = "Proximity tolerance (e.g. 0.100 m) between subsurface edges, e.g. "\
|
266
|
+
"between near-adjacent window jambs."
|
267
|
+
sub_tol = OpenStudio::Measure::OSArgument.makeDoubleArgument(arg, false)
|
268
|
+
sub_tol.setDisplayName("Proximity tolerance (m)")
|
269
|
+
sub_tol.setDescription(dsc)
|
270
|
+
sub_tol.setDefaultValue(TBD::TOL)
|
271
|
+
args << sub_tol
|
272
|
+
|
273
|
+
args
|
230
274
|
end
|
231
275
|
|
276
|
+
##
|
277
|
+
# Runs the OpenStudio TBD Measure.
|
278
|
+
#
|
279
|
+
# @param mdl [OpenStudio::Model::Model] a model
|
280
|
+
# @param runner [OpenStudio::Measure::OSRunner] Measure runner
|
281
|
+
# @param [OpenStudio::Measure::OSArgumentVector] args Measure argument list
|
282
|
+
# @option args [Bool] :alter (true) irreversibly applies changes to the model
|
283
|
+
# @option args [Bool] :load_tbd (false) whether to load a TBD JSON input file
|
284
|
+
# @option args [#to_s] :option ("poor (BETBG)") selected PSI set
|
285
|
+
# @option args [Bool] :write_tbd_json (false) whether to output a JSON file
|
286
|
+
# @option args [Bool] :parapet (true) wall-roof edge as parapet
|
287
|
+
# @option args [#to_s] :wall_option wall(s) construction to uprate
|
288
|
+
# @option args [#to_s] :roof_option roof(s) construction to uprate
|
289
|
+
# @option args [#to_s] :floor_option floor(s) construction to uprate
|
290
|
+
# @option args [#to_f] :wall_ut (0.210) target wall Ut, in (W/m2•K)
|
291
|
+
# @option args [#to_f] :roof_ut (0.138) target roof Ut, in (W/m2•K)
|
292
|
+
# @option args [#to_f] :floor_ut (0.162) target floor Ut, in (W/m2•K)
|
293
|
+
# @option args [Bool] :gen_UA_report (false) whether to generate a UA' report
|
294
|
+
# @option args [#to_s] :ua_reference ("code (Quebec)") UA' ruleset
|
295
|
+
# @option args [Bool] :gen_kiva (false) whether to generate KIVA inputs
|
296
|
+
# @option args [Bool] :gen_kiva_force (false) whether to force KIVA inputs
|
297
|
+
# @option args [Bool] :reset_kiva (false) whether to first purge KIVA inputs
|
298
|
+
# @option args [#to_f] :sub_tol (OSut::TOL) proximity tolerance between edges
|
299
|
+
#
|
300
|
+
# @return [Bool] whether TBD Measure is successful
|
232
301
|
def run(mdl, runner, args)
|
233
302
|
super(mdl, runner, args)
|
234
303
|
|
235
304
|
argh = {}
|
236
|
-
argh[:alter ] = runner.getBoolArgumentValue("alter_model",
|
237
|
-
argh[:
|
238
|
-
argh[:
|
239
|
-
argh[:
|
240
|
-
argh[:
|
241
|
-
argh[:wall_ut ] = runner.getDoubleArgumentValue("wall_ut",
|
242
|
-
argh[:roof_ut ] = runner.getDoubleArgumentValue("roof_ut",
|
243
|
-
argh[:floor_ut ] = runner.getDoubleArgumentValue("floor_ut",
|
244
|
-
argh[:wall_option ] = runner.getStringArgumentValue("wall_option",
|
245
|
-
argh[:roof_option ] = runner.getStringArgumentValue("roof_option",
|
246
|
-
argh[:floor_option ] = runner.getStringArgumentValue("floor_option",
|
247
|
-
argh[:gen_ua ] = runner.getBoolArgumentValue("gen_UA_report",
|
248
|
-
argh[:ua_ref ] = runner.getStringArgumentValue("ua_reference",
|
249
|
-
argh[:gen_kiva ] = runner.getBoolArgumentValue("gen_kiva",
|
250
|
-
argh[:kiva_force ] = runner.getBoolArgumentValue("gen_kiva_force",
|
305
|
+
argh[:alter ] = runner.getBoolArgumentValue("alter_model" , args)
|
306
|
+
argh[:load_tbd ] = runner.getBoolArgumentValue("load_tbd_json" , args)
|
307
|
+
argh[:option ] = runner.getStringArgumentValue("option" , args)
|
308
|
+
argh[:write_tbd ] = runner.getBoolArgumentValue("write_tbd_json", args)
|
309
|
+
argh[:parapet ] = runner.getBoolArgumentValue("parapet" , args)
|
310
|
+
argh[:wall_ut ] = runner.getDoubleArgumentValue("wall_ut" , args)
|
311
|
+
argh[:roof_ut ] = runner.getDoubleArgumentValue("roof_ut" , args)
|
312
|
+
argh[:floor_ut ] = runner.getDoubleArgumentValue("floor_ut" , args)
|
313
|
+
argh[:wall_option ] = runner.getStringArgumentValue("wall_option" , args)
|
314
|
+
argh[:roof_option ] = runner.getStringArgumentValue("roof_option" , args)
|
315
|
+
argh[:floor_option ] = runner.getStringArgumentValue("floor_option", args)
|
316
|
+
argh[:gen_ua ] = runner.getBoolArgumentValue("gen_UA_report" , args)
|
317
|
+
argh[:ua_ref ] = runner.getStringArgumentValue("ua_reference", args)
|
318
|
+
argh[:gen_kiva ] = runner.getBoolArgumentValue("gen_kiva" , args)
|
319
|
+
argh[:kiva_force ] = runner.getBoolArgumentValue("gen_kiva_force", args)
|
320
|
+
argh[:reset_kiva ] = runner.getBoolArgumentValue("reset_kiva" , args)
|
321
|
+
argh[:sub_tol ] = runner.getDoubleArgumentValue("sub_tol" , args)
|
251
322
|
|
252
323
|
argh[:uprate_walls ] = argh[:wall_option ] != "NONE"
|
253
324
|
argh[:uprate_roofs ] = argh[:roof_option ] != "NONE"
|
@@ -256,26 +327,26 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
256
327
|
return false unless runner.validateUserArguments(arguments(mdl), args)
|
257
328
|
|
258
329
|
if argh[:wall_ut] < TBD::TOL
|
259
|
-
runner.registerError("Wall Ut must be
|
330
|
+
runner.registerError("Wall Ut must be > 0 W/m2•K - Halting")
|
260
331
|
return false
|
261
332
|
elsif argh[:wall_ut] > 5.678 - TBD::TOL
|
262
|
-
runner.registerError("Wall Ut must be
|
333
|
+
runner.registerError("Wall Ut must be < 5.678 W/m2•K - Halting")
|
263
334
|
return false
|
264
335
|
end
|
265
336
|
|
266
337
|
if argh[:roof_ut] < TBD::TOL
|
267
|
-
runner.registerError("Roof Ut must be
|
338
|
+
runner.registerError("Roof Ut must be > 0 W/m2•K - Halting")
|
268
339
|
return false
|
269
340
|
elsif argh[:roof_ut] > 5.678 - TBD::TOL
|
270
|
-
runner.registerError("Roof Ut must be
|
341
|
+
runner.registerError("Roof Ut must be < 5.678 W/m2•K - Halting")
|
271
342
|
return false
|
272
343
|
end
|
273
344
|
|
274
345
|
if argh[:floor_ut] < TBD::TOL
|
275
|
-
runner.registerError("Floor Ut must be
|
346
|
+
runner.registerError("Floor Ut must be > 0 W/m2•K - Halting")
|
276
347
|
return false
|
277
348
|
elsif argh[:floor_ut] > 5.678 - TBD::TOL
|
278
|
-
runner.registerError("Floor Ut must be
|
349
|
+
runner.registerError("Floor Ut must be < 5.678 W/m2•K - Halting")
|
279
350
|
return false
|
280
351
|
end
|
281
352
|
|
@@ -284,42 +355,59 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
284
355
|
argh[:io_path ] = nil
|
285
356
|
|
286
357
|
if argh[:load_tbd]
|
287
|
-
argh[:io_path] = runner.workflow.findFile(
|
358
|
+
argh[:io_path] = runner.workflow.findFile("tbd.json")
|
288
359
|
|
289
360
|
if argh[:io_path].empty?
|
290
361
|
TBD.log(TBD::FTL, "Can't find 'tbd.json' - simulation halted")
|
291
362
|
return TBD.exit(runner, argh)
|
292
363
|
else
|
293
364
|
argh[:io_path] = argh[:io_path].get.to_s
|
294
|
-
# TBD.log(TBD::INF, "Using inputs from #{argh[:io_path]}")
|
295
|
-
# runner.registerInfo("Using inputs from #{argh[:io_path]}") #
|
365
|
+
# TBD.log(TBD::INF, "Using inputs from #{argh[:io_path]}") # debug
|
366
|
+
# runner.registerInfo("Using inputs from #{argh[:io_path]}") # debug
|
296
367
|
end
|
297
368
|
end
|
298
369
|
|
299
|
-
|
300
|
-
|
301
|
-
|
370
|
+
kva = false
|
371
|
+
kva = true unless mdl.getSurfacePropertyExposedFoundationPerimeters.empty?
|
372
|
+
kva = true unless mdl.getFoundationKivas.empty?
|
302
373
|
|
374
|
+
# Purge existing KIVA objects from model.
|
375
|
+
if argh[:reset_kiva]
|
376
|
+
if kva
|
377
|
+
if argh[:gen_kiva]
|
378
|
+
TBD.resetKIVA(mdl, "Foundation")
|
379
|
+
else
|
380
|
+
TBD.resetKIVA(mdl, "Ground")
|
381
|
+
end
|
382
|
+
|
383
|
+
kva = false
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
387
|
+
kva = true if argh[:kiva_force] || argh[:gen_kiva]
|
388
|
+
|
389
|
+
# Pre-validate ground-facing constructions for KIVA.
|
390
|
+
if kva
|
303
391
|
mdl.getSurfaces.each do |s|
|
304
|
-
id
|
392
|
+
id = s.nameString
|
305
393
|
construction = s.construction
|
306
394
|
next unless s.isGroundSurface
|
307
395
|
|
308
396
|
if construction.empty?
|
309
397
|
runner.registerError("Invalid construction for KIVA (#{id})")
|
310
|
-
kva = false
|
398
|
+
kva = false
|
311
399
|
else
|
312
400
|
construction = construction.get.to_LayeredConstruction
|
313
401
|
|
314
402
|
if construction.empty?
|
315
403
|
runner.registerError("KIVA requires layered constructions (#{id})")
|
316
|
-
kva = false
|
404
|
+
kva = false
|
317
405
|
else
|
318
406
|
construction = construction.get
|
319
407
|
|
320
408
|
unless TBD.standardOpaqueLayers?(construction)
|
321
409
|
runner.registerError("KIVA requires standard materials (#{id})")
|
322
|
-
kva = false
|
410
|
+
kva = false
|
323
411
|
end
|
324
412
|
end
|
325
413
|
end
|
@@ -334,16 +422,17 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
334
422
|
|
335
423
|
mdl.getSurfaces.each do |s|
|
336
424
|
next unless s.isGroundSurface
|
425
|
+
|
337
426
|
construction = s.construction.get
|
338
427
|
s.setOutsideBoundaryCondition("Foundation")
|
339
428
|
s.setConstruction(construction)
|
340
429
|
end
|
341
430
|
end
|
342
431
|
|
343
|
-
str
|
432
|
+
str = "temp_measure_manager.osm"
|
344
433
|
seed = runner.workflow.seedFile
|
345
434
|
seed = File.basename(seed.get.to_s) unless seed.empty?
|
346
|
-
seed = "OpenStudio model"
|
435
|
+
seed = "OpenStudio model" if seed.empty? || seed == str
|
347
436
|
argh[:seed] = seed
|
348
437
|
|
349
438
|
if argh[:alter]
|
@@ -353,15 +442,9 @@ class TBDMeasure < OpenStudio::Measure::ModelMeasure
|
|
353
442
|
model.addObjects(mdl.toIdfFile.objects)
|
354
443
|
end
|
355
444
|
|
356
|
-
|
357
|
-
tbd = TBD.process(model, argh)
|
358
|
-
argh[:io ] = tbd[:io ]
|
359
|
-
argh[:surfaces] = tbd[:surfaces]
|
360
|
-
setpoints = TBD.heatingTemperatureSetpoints?(model)
|
361
|
-
setpoints = TBD.coolingTemperatureSetpoints?(model) || setpoints
|
362
|
-
argh[:setpoints] = setpoints
|
445
|
+
tbd = TBD.process(model, argh)
|
363
446
|
|
364
|
-
|
447
|
+
TBD.exit(runner, argh)
|
365
448
|
end
|
366
449
|
end
|
367
450
|
|