openstudio-extension 0.1.5 → 0.1.6
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/CHANGELOG.md +4 -0
- data/lib/openstudio/extension/core/CreateResults.rb +178 -1
- data/lib/openstudio/extension/core/os_lib_geometry.rb +255 -77
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +2521 -83
- data/lib/openstudio/extension/core/os_lib_reporting.rb +133 -30
- data/lib/openstudio/extension/version.rb +1 -1
- metadata +2 -3
- data/lib/openstudio/extension/core/os_lib_cofee.rb +0 -259
@@ -810,6 +810,7 @@ module OsLib_Reporting
|
|
810
810
|
summary_types << ['Heating Capacity', 'maxHeatingCapacity', 'W', 1, 'Btu/hr', 1]
|
811
811
|
summary_types << ['Cooling Capacity', 'maxCoolingCapacity', 'W', 1, 'ton', 1]
|
812
812
|
summary_types << ['Water Flow Rate', 'maxWaterFlowRate', 'm^3/s', 4, 'gal/min', 2]
|
813
|
+
summary_types << ['Rated Power', 'ratedPower', 'W', 1, 'W', 1]
|
813
814
|
summary_types.each do |s|
|
814
815
|
val_name = s[0]
|
815
816
|
val_method = s[1]
|
@@ -1212,37 +1213,34 @@ module OsLib_Reporting
|
|
1212
1213
|
thermal_zones.each do |zone|
|
1213
1214
|
total_loop_floor_area += zone.floorArea
|
1214
1215
|
end
|
1215
|
-
|
1216
|
+
|
1216
1217
|
source_units = 'm^2'
|
1217
1218
|
if is_ip_units
|
1218
1219
|
target_units = 'ft^2'
|
1219
1220
|
else
|
1220
1221
|
target_units = source_units
|
1221
1222
|
end
|
1222
|
-
|
1223
|
-
|
1223
|
+
total_loop_floor_area = OpenStudio.convert(total_loop_floor_area, source_units, target_units).get
|
1224
|
+
total_loop_floor_area_neat = OpenStudio.toNeatString(total_loop_floor_area, 0, true)
|
1224
1225
|
|
1225
1226
|
# output zone and terminal data
|
1226
|
-
#julien
|
1227
1227
|
if is_ip_units
|
1228
|
-
output_data_air_loops[:data] << ['Thermal Zones', 'Total Floor Area', "#{
|
1228
|
+
output_data_air_loops[:data] << ['Thermal Zones', 'Total Floor Area', "#{total_loop_floor_area_neat} ft^2", '', thermal_zones.size]
|
1229
1229
|
else
|
1230
|
-
output_data_air_loops[:data] << ['Thermal Zones', 'Total Floor Area', "#{
|
1230
|
+
output_data_air_loops[:data] << ['Thermal Zones', 'Total Floor Area', "#{total_loop_floor_area_neat} m^2", '', thermal_zones.size]
|
1231
|
+
end
|
1232
|
+
|
1233
|
+
# heating and cooling temperature range data
|
1234
|
+
source_units = 'C'
|
1235
|
+
if is_ip_units
|
1236
|
+
target_units = 'F'
|
1237
|
+
target_units_display = 'F'
|
1238
|
+
else
|
1239
|
+
target_units = source_units
|
1240
|
+
target_units_display = 'C'
|
1231
1241
|
end
|
1232
1242
|
if cooling_temp_ranges.empty?
|
1233
1243
|
cooling_temp_ranges_pretty = "can't inspect schedules"
|
1234
|
-
|
1235
|
-
#julien
|
1236
|
-
source_units = 'C'
|
1237
|
-
if is_ip_units
|
1238
|
-
target_units = 'F'
|
1239
|
-
target_units_display = "F"
|
1240
|
-
else
|
1241
|
-
target_units = source_units
|
1242
|
-
target_units_display = "C"
|
1243
|
-
end
|
1244
|
-
|
1245
|
-
|
1246
1244
|
else
|
1247
1245
|
cooling_temp_ranges_pretty = "#{OpenStudio.convert(cooling_temp_ranges.min, source_units, target_units).get.round(1)} to #{OpenStudio.convert(cooling_temp_ranges.max, source_units, target_units).get.round(1)}"
|
1248
1246
|
end
|
@@ -1251,17 +1249,6 @@ module OsLib_Reporting
|
|
1251
1249
|
else
|
1252
1250
|
heating_temps_ranges_pretty = "#{OpenStudio.convert(heating_temps_ranges.min, source_units, target_units).get.round(1)} to #{OpenStudio.convert(heating_temps_ranges.max, source_units, target_units).get.round(1)}"
|
1253
1251
|
end
|
1254
|
-
|
1255
|
-
#julien
|
1256
|
-
source_units = 'C'
|
1257
|
-
if is_ip_units
|
1258
|
-
target_units = 'F'
|
1259
|
-
target_units_display = "F"
|
1260
|
-
else
|
1261
|
-
target_units = source_units
|
1262
|
-
target_units_display = "C"
|
1263
|
-
end
|
1264
|
-
#julien => ok? Tjs dans la boucle?
|
1265
1252
|
output_data_air_loops[:data] << ['Thermal Zones', 'Cooling Setpoint Range', "#{cooling_temp_ranges_pretty} #{target_units_display}", '', '']
|
1266
1253
|
output_data_air_loops[:data] << ['Thermal Zones', 'Heating Setpoint Range', "#{heating_temps_ranges_pretty} #{target_units_display}", '', '']
|
1267
1254
|
output_data_air_loops[:data] << ['Terminal Types Used', terminals.uniq.sort.join(', '), '', '', terminals.size]
|
@@ -3024,6 +3011,13 @@ module OsLib_Reporting
|
|
3024
3011
|
ann_env_pd = OsLib_Reporting.ann_env_pd(sqlFile)
|
3025
3012
|
if ann_env_pd
|
3026
3013
|
|
3014
|
+
# store values about humidity fir reguster values
|
3015
|
+
zone_max_hours_over_70_rh = 0
|
3016
|
+
zone_max_hours_over_55_rh = 0
|
3017
|
+
rh_hours_threshold = 10 #hr
|
3018
|
+
num_zones_x_hours_over_70 = 0
|
3019
|
+
num_zones_x_hours_over_55 = 0
|
3020
|
+
|
3027
3021
|
# get keys
|
3028
3022
|
keys = sqlFile.availableKeyValues(ann_env_pd, 'Hourly', 'Zone Air Relative Humidity')
|
3029
3023
|
keys.each do |key|
|
@@ -3032,6 +3026,10 @@ module OsLib_Reporting
|
|
3032
3026
|
humidity_bins[k] = 0
|
3033
3027
|
end
|
3034
3028
|
|
3029
|
+
# reset humidity zone flag
|
3030
|
+
zone_rh_count_hr_55 = 0.0
|
3031
|
+
zone_rh_count_hr_70 = 0.0
|
3032
|
+
|
3035
3033
|
# get desired variable
|
3036
3034
|
output_timeseries = sqlFile.timeSeries(ann_env_pd, 'Hourly', 'Zone Air Relative Humidity', key)
|
3037
3035
|
# loop through timeseries and move the data from an OpenStudio timeseries to a normal Ruby array (vector)
|
@@ -3079,11 +3077,34 @@ module OsLib_Reporting
|
|
3079
3077
|
else
|
3080
3078
|
row_color << ''
|
3081
3079
|
end
|
3080
|
+
|
3081
|
+
# populate rh data for register_values
|
3082
|
+
# catch greater than 70 and 80 for runner.registerValue
|
3083
|
+
if ['55-60','60-65','65-70','70-75','75-80','>= 80'].include?(k)
|
3084
|
+
zone_rh_count_hr_55 += v
|
3085
|
+
end
|
3086
|
+
if ['70-75','75-80','>= 80'].include?(k)
|
3087
|
+
zone_rh_count_hr_70 += v
|
3088
|
+
end
|
3089
|
+
|
3082
3090
|
end
|
3083
3091
|
row_data += ["#{mean.round(1)} (%)"]
|
3084
3092
|
row_color += ['']
|
3085
3093
|
humidity_table[:data] << row_data
|
3086
3094
|
humidity_table[:data_color] << row_color
|
3095
|
+
|
3096
|
+
# apply rh zones and max hours
|
3097
|
+
if zone_rh_count_hr_55 >= rh_hours_threshold then num_zones_x_hours_over_55 += 1 end
|
3098
|
+
if zone_rh_count_hr_70 >= rh_hours_threshold then num_zones_x_hours_over_70 += 1 end
|
3099
|
+
if zone_max_hours_over_55_rh < zone_rh_count_hr_55 then zone_max_hours_over_55_rh = zone_rh_count_hr_55 end
|
3100
|
+
if zone_max_hours_over_70_rh < zone_rh_count_hr_70 then zone_max_hours_over_70_rh = zone_rh_count_hr_70 end
|
3101
|
+
|
3102
|
+
# add rh runner.registerValues to be used as output in analyses
|
3103
|
+
runner.registerValue("zone_max_hours_over_70_rh",zone_max_hours_over_70_rh,"hr")
|
3104
|
+
runner.registerValue("zone_max_hours_over_55_rh",zone_max_hours_over_55_rh,"hr")
|
3105
|
+
runner.registerValue("num_zones_x_hours_over_70",num_zones_x_hours_over_70,"zones")
|
3106
|
+
runner.registerValue("num_zones_x_hours_over_55",num_zones_x_hours_over_55,"zones")
|
3107
|
+
|
3087
3108
|
end
|
3088
3109
|
else
|
3089
3110
|
runner.registerWarning('An annual simulation was not run. Cannot get annual timeseries data')
|
@@ -4649,4 +4670,86 @@ module OsLib_Reporting
|
|
4649
4670
|
|
4650
4671
|
return @schedules_overview_section
|
4651
4672
|
end
|
4652
|
-
|
4673
|
+
|
4674
|
+
# create measure_warning_section (creates tables and runner.registerValues)
|
4675
|
+
def self.measure_warning_section(model, sqlFile, runner, name_only = false, is_ip_units = true)
|
4676
|
+
# array to hold tables
|
4677
|
+
measure_tables = []
|
4678
|
+
|
4679
|
+
# gather data for section
|
4680
|
+
@measure_warnings_section = {}
|
4681
|
+
@measure_warnings_section[:title] = 'Measure Warnings'
|
4682
|
+
@measure_warnings_section[:tables] = measure_tables
|
4683
|
+
|
4684
|
+
# stop here if only name is requested this is used to populate display name for arguments
|
4685
|
+
if name_only == true
|
4686
|
+
return @measure_warnings_section
|
4687
|
+
end
|
4688
|
+
|
4689
|
+
# will be used for registerValues
|
4690
|
+
num_measures_with_warnings = 0
|
4691
|
+
num_warnings = 0
|
4692
|
+
num_measures = 0
|
4693
|
+
|
4694
|
+
# loop through workflow steps
|
4695
|
+
runner.workflow.workflowSteps.each do |step|
|
4696
|
+
if step.to_MeasureStep.is_initialized
|
4697
|
+
measure_step = step.to_MeasureStep.get
|
4698
|
+
measure_name = measure_step.measureDirName
|
4699
|
+
num_measures += 1
|
4700
|
+
if measure_step.name.is_initialized
|
4701
|
+
measure_name = measure_step.name.get # this is instance name in PAT
|
4702
|
+
end
|
4703
|
+
if measure_step.result.is_initialized
|
4704
|
+
result = measure_step.result.get
|
4705
|
+
# create and populate table if warnings exist
|
4706
|
+
if result.warnings.size > 0
|
4707
|
+
measure_table_01 = {}
|
4708
|
+
measure_table_01[:title] = measure_name
|
4709
|
+
measure_table_01[:header] = ['Warning']
|
4710
|
+
measure_table_01[:data] = []
|
4711
|
+
num_measures_with_warnings += 1
|
4712
|
+
|
4713
|
+
# step through warnings
|
4714
|
+
start_counter = num_warnings
|
4715
|
+
result.warnings.each do |step|
|
4716
|
+
# add rows to table and register value
|
4717
|
+
num_warnings += 1
|
4718
|
+
if num_warnings < start_counter + 25
|
4719
|
+
measure_table_01[:data] << [step.logMessage]
|
4720
|
+
else
|
4721
|
+
measure_table_01[:data] << ["* See OSW file for full list of warnings. This measure has #{result.warnings.size} warnings."]
|
4722
|
+
end
|
4723
|
+
end
|
4724
|
+
# add table to section
|
4725
|
+
measure_tables << measure_table_01
|
4726
|
+
end
|
4727
|
+
else
|
4728
|
+
# puts "No result for #{measure_name}"
|
4729
|
+
end
|
4730
|
+
else
|
4731
|
+
# puts "This step is not a measure"
|
4732
|
+
end
|
4733
|
+
end
|
4734
|
+
|
4735
|
+
# add summary table (even when there are no warnings)
|
4736
|
+
measure_table_summary = {}
|
4737
|
+
measure_table_summary[:title] = "Measure Warning Summary"
|
4738
|
+
measure_table_summary[:header] = ['Description','Count']
|
4739
|
+
measure_table_summary[:data] = []
|
4740
|
+
|
4741
|
+
# add summary rows
|
4742
|
+
measure_table_summary[:data] << ['Number of measures in workflow',num_measures]
|
4743
|
+
measure_table_summary[:data] << ['Number of measures with warnings',num_measures_with_warnings]
|
4744
|
+
measure_table_summary[:data] << ['Total number of warnings',num_warnings]
|
4745
|
+
|
4746
|
+
# add table to section
|
4747
|
+
measure_tables << measure_table_summary
|
4748
|
+
|
4749
|
+
runner.registerValue("number_of_measures_with_warnings", num_measures_with_warnings)
|
4750
|
+
runner.registerValue("number_warnings", num_warnings)
|
4751
|
+
|
4752
|
+
return @measure_warnings_section
|
4753
|
+
end
|
4754
|
+
|
4755
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstudio-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katherine Fleming
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-02-
|
13
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -197,7 +197,6 @@ files:
|
|
197
197
|
- lib/openstudio/extension/core/check_weather_files.rb
|
198
198
|
- lib/openstudio/extension/core/deer_vintages.rb
|
199
199
|
- lib/openstudio/extension/core/os_lib_aedg_measures.rb
|
200
|
-
- lib/openstudio/extension/core/os_lib_cofee.rb
|
201
200
|
- lib/openstudio/extension/core/os_lib_constructions.rb
|
202
201
|
- lib/openstudio/extension/core/os_lib_geometry.rb
|
203
202
|
- lib/openstudio/extension/core/os_lib_helper_methods.rb
|
@@ -1,259 +0,0 @@
|
|
1
|
-
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-2020, 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
|
-
end
|