openstudio-extension 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +29 -26
- data/.rspec +3 -3
- data/.rubocop.yml +10 -9
- data/CHANGELOG.md +16 -0
- data/Gemfile +6 -6
- data/Jenkinsfile +10 -10
- data/README.md +251 -250
- data/Rakefile +119 -119
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/doc_templates/LICENSE.md +26 -26
- data/doc_templates/README.md.erb +41 -41
- data/doc_templates/copyright_erb.txt +35 -35
- data/doc_templates/copyright_js.txt +3 -3
- data/doc_templates/copyright_ruby.txt +33 -33
- data/init_templates/README.md +37 -37
- data/init_templates/gemspec.txt +32 -32
- data/init_templates/openstudio_module.rb +50 -50
- data/init_templates/spec.rb +47 -47
- data/init_templates/spec_helper.rb +49 -49
- data/init_templates/template_gemfile.txt +17 -17
- data/init_templates/template_rakefile.txt +15 -15
- data/init_templates/version.rb +40 -40
- data/lib/files/openstudio-extension-gem-test.ddy +536 -536
- data/lib/files/openstudio-extension-gem-test.epw +8768 -8768
- data/lib/files/openstudio-extension-gem-test.stat +554 -554
- data/lib/measures/openstudio_extension_test_measure/LICENSE.md +26 -26
- data/lib/measures/openstudio_extension_test_measure/README.md +26 -26
- data/lib/measures/openstudio_extension_test_measure/README.md.erb +41 -41
- data/lib/measures/openstudio_extension_test_measure/measure.rb +72 -72
- data/lib/measures/openstudio_extension_test_measure/measure.xml +83 -83
- data/lib/measures/openstudio_extension_test_measure/resources/os_lib_helper_methods.rb +399 -399
- data/lib/measures/openstudio_extension_test_measure/tests/{OpenStudioExtensionTestMeasure_Test.rb → openstudio_extension_test_measure_test.rb} +74 -75
- data/lib/openstudio-extension.rb +1 -1
- data/lib/openstudio/extension.rb +234 -229
- data/lib/openstudio/extension/core/CreateResults.rb +886 -886
- data/lib/openstudio/extension/core/check_air_sys_temps.rb +190 -190
- data/lib/openstudio/extension/core/check_calibration.rb +155 -155
- data/lib/openstudio/extension/core/check_cond_zns.rb +84 -84
- data/lib/openstudio/extension/core/check_domestic_hot_water.rb +334 -334
- data/lib/openstudio/extension/core/check_envelope_conductance.rb +453 -453
- data/lib/openstudio/extension/core/check_eui_by_end_use.rb +162 -162
- data/lib/openstudio/extension/core/check_eui_reasonableness.rb +135 -135
- data/lib/openstudio/extension/core/check_fan_pwr.rb +98 -98
- data/lib/openstudio/extension/core/check_internal_loads.rb +393 -393
- data/lib/openstudio/extension/core/check_mech_sys_capacity.rb +226 -226
- data/lib/openstudio/extension/core/check_mech_sys_efficiency.rb +326 -326
- data/lib/openstudio/extension/core/check_mech_sys_part_load_eff.rb +464 -464
- data/lib/openstudio/extension/core/check_mech_sys_type.rb +139 -139
- data/lib/openstudio/extension/core/check_part_loads.rb +451 -451
- data/lib/openstudio/extension/core/check_placeholder.rb +75 -75
- data/lib/openstudio/extension/core/check_plant_cap.rb +123 -123
- data/lib/openstudio/extension/core/check_plant_temps.rb +159 -159
- data/lib/openstudio/extension/core/check_plenum_loads.rb +87 -87
- data/lib/openstudio/extension/core/check_pump_pwr.rb +108 -108
- data/lib/openstudio/extension/core/check_sch_coord.rb +241 -241
- data/lib/openstudio/extension/core/check_schedules.rb +311 -311
- data/lib/openstudio/extension/core/check_simultaneous_heating_and_cooling.rb +158 -158
- data/lib/openstudio/extension/core/check_supply_air_and_thermostat_temp_difference.rb +148 -148
- data/lib/openstudio/extension/core/check_weather_files.rb +132 -132
- data/lib/openstudio/extension/core/deer_vintages.rb +311 -311
- data/lib/openstudio/extension/core/os_lib_aedg_measures.rb +491 -491
- data/lib/openstudio/extension/core/os_lib_cofee.rb +258 -258
- data/lib/openstudio/extension/core/os_lib_constructions.rb +378 -378
- data/lib/openstudio/extension/core/os_lib_geometry.rb +1022 -1022
- data/lib/openstudio/extension/core/os_lib_helper_methods.rb +399 -399
- data/lib/openstudio/extension/core/os_lib_hvac.rb +2171 -2171
- data/lib/openstudio/extension/core/os_lib_lighting_and_equipment.rb +214 -214
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +817 -817
- data/lib/openstudio/extension/core/os_lib_model_simplification.rb +1049 -1049
- data/lib/openstudio/extension/core/os_lib_outdoorair_and_infiltration.rb +165 -165
- data/lib/openstudio/extension/core/os_lib_reporting.rb +4651 -4651
- data/lib/openstudio/extension/core/os_lib_reporting_qaqc.rb +200 -200
- data/lib/openstudio/extension/core/os_lib_schedules.rb +963 -963
- data/lib/openstudio/extension/rake_task.rb +159 -149
- data/lib/openstudio/extension/runner.rb +667 -644
- data/lib/openstudio/extension/runner_config.rb +114 -0
- data/lib/openstudio/extension/version.rb +40 -40
- data/openstudio-extension.gemspec +34 -33
- metadata +39 -37
@@ -1,259 +1,259 @@
|
|
1
|
-
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
|
3
|
-
# All rights reserved.
|
4
|
-
# Redistribution and use in source and binary forms, with or without
|
5
|
-
# modification, are permitted provided that the following conditions are met:
|
6
|
-
#
|
7
|
-
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
-
# this list of conditions and the following disclaimer.
|
9
|
-
#
|
10
|
-
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
-
# this list of conditions and the following disclaimer in the documentation
|
12
|
-
# and/or other materials provided with the distribution.
|
13
|
-
#
|
14
|
-
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
-
# may be used to endorse or promote products derived from this software without
|
16
|
-
# specific prior written permission from the respective party.
|
17
|
-
#
|
18
|
-
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
-
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
-
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
-
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
-
#
|
23
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
24
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
25
|
-
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
27
|
-
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
28
|
-
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
29
|
-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
30
|
-
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
32
|
-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
33
|
-
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
-
# *******************************************************************************
|
35
|
-
|
36
|
-
module OsLib_Cofee
|
37
|
-
|
38
|
-
# create def to use later to make bar
|
39
|
-
def OsLib_Cofee.createBar(model, spaceTypeHash,lengthXTarget,lengthYTarget,totalFloorArea,numStories,midFloorMultiplier,xmin,ymin,lengthX,lengthY,zmin,zmax,endZones)
|
40
|
-
|
41
|
-
# floor to floor height
|
42
|
-
floor_to_floor_height = (zmax-zmin)/numStories
|
43
|
-
|
44
|
-
# perimeter depth
|
45
|
-
perimeterDepth = OpenStudio::convert(12,"ft","m").get
|
46
|
-
perimeterBufferFactor = 1.5 # this is a margin below which I won't bother splitting the two largest spaces
|
47
|
-
|
48
|
-
# create an array to control sort order of spaces in bar
|
49
|
-
customSpaceTypeBar = []
|
50
|
-
counter = 0
|
51
|
-
spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
52
|
-
next if v == 0 # this line adds support for fractional values of 0
|
53
|
-
if counter == 1
|
54
|
-
if lengthXTarget*(v/totalFloorArea) > perimeterDepth * perimeterBufferFactor and endZones
|
55
|
-
customSpaceTypeBar << [k,totalFloorArea * (perimeterDepth/lengthXTarget)]
|
56
|
-
customSpaceTypeBar << [k,v - (totalFloorArea * (perimeterDepth/lengthXTarget))]
|
57
|
-
else
|
58
|
-
customSpaceTypeBar << [k,v]
|
59
|
-
end
|
60
|
-
elsif counter > 1
|
61
|
-
customSpaceTypeBar << [k,v]
|
62
|
-
end
|
63
|
-
counter += 1
|
64
|
-
end
|
65
|
-
|
66
|
-
# add the largest space type to the end
|
67
|
-
counter = 0
|
68
|
-
spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
69
|
-
if counter == 0
|
70
|
-
# if width is greater than 1.5x perimeter depth then split in half
|
71
|
-
if lengthXTarget*(v/totalFloorArea) > perimeterDepth * perimeterBufferFactor and endZones
|
72
|
-
customSpaceTypeBar << [k,v - (totalFloorArea * (perimeterDepth/lengthXTarget))]
|
73
|
-
customSpaceTypeBar << [k,totalFloorArea * (perimeterDepth/lengthXTarget)]
|
74
|
-
else
|
75
|
-
customSpaceTypeBar << [k,v]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
break
|
79
|
-
end
|
80
|
-
|
81
|
-
# starting z level
|
82
|
-
z = zmin
|
83
|
-
storyCounter = 0
|
84
|
-
barSpaceArray = []
|
85
|
-
|
86
|
-
# create new stories and then add spaces
|
87
|
-
[numStories,3].min.times do # no more than tree loops through this
|
88
|
-
story = OpenStudio::Model::BuildingStory.new(model)
|
89
|
-
story.setNominalFloortoFloorHeight(floor_to_floor_height)
|
90
|
-
story.setNominalZCoordinate(z)
|
91
|
-
|
92
|
-
# starting position for first space
|
93
|
-
x = (lengthX - lengthXTarget)*0.5 + xmin
|
94
|
-
y = (lengthY - lengthYTarget)*0.5 + ymin
|
95
|
-
|
96
|
-
# temp array of spaces (this is to change floor boundary when there is mid floor multiplier)
|
97
|
-
tempSpaceArray = []
|
98
|
-
|
99
|
-
# loop through space types making diagram and spaces.
|
100
|
-
#spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
101
|
-
customSpaceTypeBar.each do |object|
|
102
|
-
|
103
|
-
# get values from what was hash
|
104
|
-
k = object[0]
|
105
|
-
v = object[1]
|
106
|
-
|
107
|
-
# get proper zone multiplier value
|
108
|
-
if storyCounter == 1 and midFloorMultiplier > 1
|
109
|
-
thermalZoneMultiplier = midFloorMultiplier
|
110
|
-
else
|
111
|
-
thermalZoneMultiplier = 1
|
112
|
-
end
|
113
|
-
|
114
|
-
options = {
|
115
|
-
"name" => nil,
|
116
|
-
"spaceType" => k,
|
117
|
-
"story" => story,
|
118
|
-
"makeThermalZone" => true,
|
119
|
-
"thermalZone" => nil,
|
120
|
-
"thermalZoneMultiplier" => thermalZoneMultiplier,
|
121
|
-
"floor_to_floor_height" => floor_to_floor_height,
|
122
|
-
}
|
123
|
-
|
124
|
-
# three paths for spaces depending upon building depth (3, 2 or one cross slices)
|
125
|
-
if lengthYTarget > perimeterDepth * 3 # slice into core and perimeter
|
126
|
-
|
127
|
-
# perimeter polygon a
|
128
|
-
perim_polygon_a = OpenStudio::Point3dVector.new
|
129
|
-
perim_origin_a = OpenStudio::Point3d.new(x,y,z)
|
130
|
-
perim_polygon_a << perim_origin_a
|
131
|
-
perim_polygon_a << OpenStudio::Point3d.new(x,y + perimeterDepth,z)
|
132
|
-
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + perimeterDepth,z)
|
133
|
-
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
134
|
-
|
135
|
-
# create core polygon
|
136
|
-
core_polygon = OpenStudio::Point3dVector.new
|
137
|
-
core_origin = OpenStudio::Point3d.new(x,y + perimeterDepth,z)
|
138
|
-
core_polygon << core_origin
|
139
|
-
core_polygon << OpenStudio::Point3d.new(x,y + lengthYTarget - perimeterDepth,z)
|
140
|
-
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget - perimeterDepth,z)
|
141
|
-
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + perimeterDepth,z)
|
142
|
-
|
143
|
-
# perimeter polygon b w
|
144
|
-
perim_polygon_b = OpenStudio::Point3dVector.new
|
145
|
-
perim_origin_b = OpenStudio::Point3d.new(x,y + lengthYTarget - perimeterDepth,z)
|
146
|
-
perim_polygon_b << perim_origin_b
|
147
|
-
perim_polygon_b << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
148
|
-
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
149
|
-
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget - perimeterDepth,z)
|
150
|
-
|
151
|
-
# run method to make spaces
|
152
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_a,perim_polygon_a,options) # model, origin, polygon, options
|
153
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,core_origin,core_polygon,options) # model, origin, polygon, options
|
154
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_b,perim_polygon_b,options) # model, origin, polygon, options
|
155
|
-
|
156
|
-
elsif lengthYTarget > perimeterDepth * 2 # slice into two peremeter zones but no core
|
157
|
-
|
158
|
-
# perimeter polygon a
|
159
|
-
perim_polygon_a = OpenStudio::Point3dVector.new
|
160
|
-
perim_origin_a = OpenStudio::Point3d.new(x,y,z)
|
161
|
-
perim_polygon_a << perim_origin_a
|
162
|
-
perim_polygon_a << OpenStudio::Point3d.new(x,y + lengthYTarget/2,z)
|
163
|
-
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget/2,z)
|
164
|
-
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
165
|
-
|
166
|
-
# perimeter polygon b
|
167
|
-
perim_polygon_b = OpenStudio::Point3dVector.new
|
168
|
-
perim_origin_b = OpenStudio::Point3d.new(x,y + lengthYTarget/2,z)
|
169
|
-
perim_polygon_b << perim_origin_b
|
170
|
-
perim_polygon_b << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
171
|
-
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
172
|
-
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget/2,z)
|
173
|
-
|
174
|
-
# run method to make spaces
|
175
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_a,perim_polygon_a,options) # model, origin, polygon, options
|
176
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_b,perim_polygon_b,options) # model, origin, polygon, options
|
177
|
-
|
178
|
-
else # don't slice into core and perimeter
|
179
|
-
|
180
|
-
# create polygon
|
181
|
-
core_polygon = OpenStudio::Point3dVector.new
|
182
|
-
core_origin = OpenStudio::Point3d.new(x,y,z)
|
183
|
-
core_polygon << core_origin
|
184
|
-
core_polygon << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
185
|
-
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
186
|
-
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
187
|
-
|
188
|
-
# run method to make space
|
189
|
-
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,core_origin,core_polygon,options) # model, origin, polygon, options
|
190
|
-
|
191
|
-
end
|
192
|
-
|
193
|
-
# update points for next run
|
194
|
-
x += lengthXTarget*(v/totalFloorArea)
|
195
|
-
|
196
|
-
end
|
197
|
-
|
198
|
-
# set flags for adiabatic surfaces
|
199
|
-
floorAdiabatic = false
|
200
|
-
ceilingAdiabatic = false
|
201
|
-
|
202
|
-
# update z
|
203
|
-
if midFloorMultiplier == 1
|
204
|
-
z += floor_to_floor_height
|
205
|
-
else
|
206
|
-
z += floor_to_floor_height * midFloorMultiplier - floor_to_floor_height
|
207
|
-
|
208
|
-
if storyCounter == 0
|
209
|
-
ceilingAdiabatic = true
|
210
|
-
elsif storyCounter == 1
|
211
|
-
floorAdiabatic = true
|
212
|
-
ceilingAdiabatic = true
|
213
|
-
else
|
214
|
-
floorAdiabatic = true
|
215
|
-
end
|
216
|
-
|
217
|
-
# alter surfaces boundary conditions and constructions as described above
|
218
|
-
tempSpaceArray.each do |space|
|
219
|
-
space.surfaces.each do |surface|
|
220
|
-
if surface.surfaceType == "RoofCeiling" and ceilingAdiabatic
|
221
|
-
construction = surface.construction # todo - this isn't really the construction I want since it wasn't an interior one, but will work for now
|
222
|
-
surface.setOutsideBoundaryCondition("Adiabatic")
|
223
|
-
if not construction.empty?
|
224
|
-
surface.setConstruction(construction.get)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
if surface.surfaceType == "Floor" and floorAdiabatic
|
228
|
-
construction = surface.construction # todo - this isn't really the construction I want since it wasn't an interior one, but will work for now
|
229
|
-
surface.setOutsideBoundaryCondition("Adiabatic")
|
230
|
-
if not construction.empty?
|
231
|
-
surface.setConstruction(construction.get)
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
|
237
|
-
# populate bar space array from temp array
|
238
|
-
barSpaceArray << tempSpaceArray
|
239
|
-
|
240
|
-
end
|
241
|
-
|
242
|
-
# update storyCounter
|
243
|
-
storyCounter += 1
|
244
|
-
|
245
|
-
end
|
246
|
-
|
247
|
-
# surface matching (seems more complex than necessary)
|
248
|
-
spaces = OpenStudio::Model::SpaceVector.new
|
249
|
-
model.getSpaces.each do |space|
|
250
|
-
spaces << space
|
251
|
-
end
|
252
|
-
OpenStudio::Model.matchSurfaces(spaces)
|
253
|
-
|
254
|
-
result = barSpaceArray
|
255
|
-
return result
|
256
|
-
|
257
|
-
end
|
258
|
-
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC.
|
3
|
+
# All rights reserved.
|
4
|
+
# Redistribution and use in source and binary forms, with or without
|
5
|
+
# modification, are permitted provided that the following conditions are met:
|
6
|
+
#
|
7
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
8
|
+
# this list of conditions and the following disclaimer.
|
9
|
+
#
|
10
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
# this list of conditions and the following disclaimer in the documentation
|
12
|
+
# and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
15
|
+
# may be used to endorse or promote products derived from this software without
|
16
|
+
# specific prior written permission from the respective party.
|
17
|
+
#
|
18
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
19
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
20
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
21
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
22
|
+
#
|
23
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
24
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
27
|
+
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
28
|
+
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
29
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
30
|
+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
32
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
33
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
# *******************************************************************************
|
35
|
+
|
36
|
+
module OsLib_Cofee
|
37
|
+
|
38
|
+
# create def to use later to make bar
|
39
|
+
def OsLib_Cofee.createBar(model, spaceTypeHash,lengthXTarget,lengthYTarget,totalFloorArea,numStories,midFloorMultiplier,xmin,ymin,lengthX,lengthY,zmin,zmax,endZones)
|
40
|
+
|
41
|
+
# floor to floor height
|
42
|
+
floor_to_floor_height = (zmax-zmin)/numStories
|
43
|
+
|
44
|
+
# perimeter depth
|
45
|
+
perimeterDepth = OpenStudio::convert(12,"ft","m").get
|
46
|
+
perimeterBufferFactor = 1.5 # this is a margin below which I won't bother splitting the two largest spaces
|
47
|
+
|
48
|
+
# create an array to control sort order of spaces in bar
|
49
|
+
customSpaceTypeBar = []
|
50
|
+
counter = 0
|
51
|
+
spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
52
|
+
next if v == 0 # this line adds support for fractional values of 0
|
53
|
+
if counter == 1
|
54
|
+
if lengthXTarget*(v/totalFloorArea) > perimeterDepth * perimeterBufferFactor and endZones
|
55
|
+
customSpaceTypeBar << [k,totalFloorArea * (perimeterDepth/lengthXTarget)]
|
56
|
+
customSpaceTypeBar << [k,v - (totalFloorArea * (perimeterDepth/lengthXTarget))]
|
57
|
+
else
|
58
|
+
customSpaceTypeBar << [k,v]
|
59
|
+
end
|
60
|
+
elsif counter > 1
|
61
|
+
customSpaceTypeBar << [k,v]
|
62
|
+
end
|
63
|
+
counter += 1
|
64
|
+
end
|
65
|
+
|
66
|
+
# add the largest space type to the end
|
67
|
+
counter = 0
|
68
|
+
spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
69
|
+
if counter == 0
|
70
|
+
# if width is greater than 1.5x perimeter depth then split in half
|
71
|
+
if lengthXTarget*(v/totalFloorArea) > perimeterDepth * perimeterBufferFactor and endZones
|
72
|
+
customSpaceTypeBar << [k,v - (totalFloorArea * (perimeterDepth/lengthXTarget))]
|
73
|
+
customSpaceTypeBar << [k,totalFloorArea * (perimeterDepth/lengthXTarget)]
|
74
|
+
else
|
75
|
+
customSpaceTypeBar << [k,v]
|
76
|
+
end
|
77
|
+
end
|
78
|
+
break
|
79
|
+
end
|
80
|
+
|
81
|
+
# starting z level
|
82
|
+
z = zmin
|
83
|
+
storyCounter = 0
|
84
|
+
barSpaceArray = []
|
85
|
+
|
86
|
+
# create new stories and then add spaces
|
87
|
+
[numStories,3].min.times do # no more than tree loops through this
|
88
|
+
story = OpenStudio::Model::BuildingStory.new(model)
|
89
|
+
story.setNominalFloortoFloorHeight(floor_to_floor_height)
|
90
|
+
story.setNominalZCoordinate(z)
|
91
|
+
|
92
|
+
# starting position for first space
|
93
|
+
x = (lengthX - lengthXTarget)*0.5 + xmin
|
94
|
+
y = (lengthY - lengthYTarget)*0.5 + ymin
|
95
|
+
|
96
|
+
# temp array of spaces (this is to change floor boundary when there is mid floor multiplier)
|
97
|
+
tempSpaceArray = []
|
98
|
+
|
99
|
+
# loop through space types making diagram and spaces.
|
100
|
+
#spaceTypeHash.sort_by {|key, value| value}.reverse.each do |k,v|
|
101
|
+
customSpaceTypeBar.each do |object|
|
102
|
+
|
103
|
+
# get values from what was hash
|
104
|
+
k = object[0]
|
105
|
+
v = object[1]
|
106
|
+
|
107
|
+
# get proper zone multiplier value
|
108
|
+
if storyCounter == 1 and midFloorMultiplier > 1
|
109
|
+
thermalZoneMultiplier = midFloorMultiplier
|
110
|
+
else
|
111
|
+
thermalZoneMultiplier = 1
|
112
|
+
end
|
113
|
+
|
114
|
+
options = {
|
115
|
+
"name" => nil,
|
116
|
+
"spaceType" => k,
|
117
|
+
"story" => story,
|
118
|
+
"makeThermalZone" => true,
|
119
|
+
"thermalZone" => nil,
|
120
|
+
"thermalZoneMultiplier" => thermalZoneMultiplier,
|
121
|
+
"floor_to_floor_height" => floor_to_floor_height,
|
122
|
+
}
|
123
|
+
|
124
|
+
# three paths for spaces depending upon building depth (3, 2 or one cross slices)
|
125
|
+
if lengthYTarget > perimeterDepth * 3 # slice into core and perimeter
|
126
|
+
|
127
|
+
# perimeter polygon a
|
128
|
+
perim_polygon_a = OpenStudio::Point3dVector.new
|
129
|
+
perim_origin_a = OpenStudio::Point3d.new(x,y,z)
|
130
|
+
perim_polygon_a << perim_origin_a
|
131
|
+
perim_polygon_a << OpenStudio::Point3d.new(x,y + perimeterDepth,z)
|
132
|
+
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + perimeterDepth,z)
|
133
|
+
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
134
|
+
|
135
|
+
# create core polygon
|
136
|
+
core_polygon = OpenStudio::Point3dVector.new
|
137
|
+
core_origin = OpenStudio::Point3d.new(x,y + perimeterDepth,z)
|
138
|
+
core_polygon << core_origin
|
139
|
+
core_polygon << OpenStudio::Point3d.new(x,y + lengthYTarget - perimeterDepth,z)
|
140
|
+
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget - perimeterDepth,z)
|
141
|
+
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + perimeterDepth,z)
|
142
|
+
|
143
|
+
# perimeter polygon b w
|
144
|
+
perim_polygon_b = OpenStudio::Point3dVector.new
|
145
|
+
perim_origin_b = OpenStudio::Point3d.new(x,y + lengthYTarget - perimeterDepth,z)
|
146
|
+
perim_polygon_b << perim_origin_b
|
147
|
+
perim_polygon_b << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
148
|
+
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
149
|
+
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget - perimeterDepth,z)
|
150
|
+
|
151
|
+
# run method to make spaces
|
152
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_a,perim_polygon_a,options) # model, origin, polygon, options
|
153
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,core_origin,core_polygon,options) # model, origin, polygon, options
|
154
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_b,perim_polygon_b,options) # model, origin, polygon, options
|
155
|
+
|
156
|
+
elsif lengthYTarget > perimeterDepth * 2 # slice into two peremeter zones but no core
|
157
|
+
|
158
|
+
# perimeter polygon a
|
159
|
+
perim_polygon_a = OpenStudio::Point3dVector.new
|
160
|
+
perim_origin_a = OpenStudio::Point3d.new(x,y,z)
|
161
|
+
perim_polygon_a << perim_origin_a
|
162
|
+
perim_polygon_a << OpenStudio::Point3d.new(x,y + lengthYTarget/2,z)
|
163
|
+
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget/2,z)
|
164
|
+
perim_polygon_a << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
165
|
+
|
166
|
+
# perimeter polygon b
|
167
|
+
perim_polygon_b = OpenStudio::Point3dVector.new
|
168
|
+
perim_origin_b = OpenStudio::Point3d.new(x,y + lengthYTarget/2,z)
|
169
|
+
perim_polygon_b << perim_origin_b
|
170
|
+
perim_polygon_b << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
171
|
+
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
172
|
+
perim_polygon_b << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget/2,z)
|
173
|
+
|
174
|
+
# run method to make spaces
|
175
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_a,perim_polygon_a,options) # model, origin, polygon, options
|
176
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,perim_origin_b,perim_polygon_b,options) # model, origin, polygon, options
|
177
|
+
|
178
|
+
else # don't slice into core and perimeter
|
179
|
+
|
180
|
+
# create polygon
|
181
|
+
core_polygon = OpenStudio::Point3dVector.new
|
182
|
+
core_origin = OpenStudio::Point3d.new(x,y,z)
|
183
|
+
core_polygon << core_origin
|
184
|
+
core_polygon << OpenStudio::Point3d.new(x,y + lengthYTarget,z)
|
185
|
+
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y + lengthYTarget,z)
|
186
|
+
core_polygon << OpenStudio::Point3d.new(x + lengthXTarget*(v/totalFloorArea),y,z)
|
187
|
+
|
188
|
+
# run method to make space
|
189
|
+
tempSpaceArray << OsLib_Geometry.makeSpaceFromPolygon(model,core_origin,core_polygon,options) # model, origin, polygon, options
|
190
|
+
|
191
|
+
end
|
192
|
+
|
193
|
+
# update points for next run
|
194
|
+
x += lengthXTarget*(v/totalFloorArea)
|
195
|
+
|
196
|
+
end
|
197
|
+
|
198
|
+
# set flags for adiabatic surfaces
|
199
|
+
floorAdiabatic = false
|
200
|
+
ceilingAdiabatic = false
|
201
|
+
|
202
|
+
# update z
|
203
|
+
if midFloorMultiplier == 1
|
204
|
+
z += floor_to_floor_height
|
205
|
+
else
|
206
|
+
z += floor_to_floor_height * midFloorMultiplier - floor_to_floor_height
|
207
|
+
|
208
|
+
if storyCounter == 0
|
209
|
+
ceilingAdiabatic = true
|
210
|
+
elsif storyCounter == 1
|
211
|
+
floorAdiabatic = true
|
212
|
+
ceilingAdiabatic = true
|
213
|
+
else
|
214
|
+
floorAdiabatic = true
|
215
|
+
end
|
216
|
+
|
217
|
+
# alter surfaces boundary conditions and constructions as described above
|
218
|
+
tempSpaceArray.each do |space|
|
219
|
+
space.surfaces.each do |surface|
|
220
|
+
if surface.surfaceType == "RoofCeiling" and ceilingAdiabatic
|
221
|
+
construction = surface.construction # todo - this isn't really the construction I want since it wasn't an interior one, but will work for now
|
222
|
+
surface.setOutsideBoundaryCondition("Adiabatic")
|
223
|
+
if not construction.empty?
|
224
|
+
surface.setConstruction(construction.get)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
if surface.surfaceType == "Floor" and floorAdiabatic
|
228
|
+
construction = surface.construction # todo - this isn't really the construction I want since it wasn't an interior one, but will work for now
|
229
|
+
surface.setOutsideBoundaryCondition("Adiabatic")
|
230
|
+
if not construction.empty?
|
231
|
+
surface.setConstruction(construction.get)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
# populate bar space array from temp array
|
238
|
+
barSpaceArray << tempSpaceArray
|
239
|
+
|
240
|
+
end
|
241
|
+
|
242
|
+
# update storyCounter
|
243
|
+
storyCounter += 1
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
# surface matching (seems more complex than necessary)
|
248
|
+
spaces = OpenStudio::Model::SpaceVector.new
|
249
|
+
model.getSpaces.each do |space|
|
250
|
+
spaces << space
|
251
|
+
end
|
252
|
+
OpenStudio::Model.matchSurfaces(spaces)
|
253
|
+
|
254
|
+
result = barSpaceArray
|
255
|
+
return result
|
256
|
+
|
257
|
+
end
|
258
|
+
|
259
259
|
end
|