openstudio-extension 0.2.6 → 0.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/CHANGELOG.md +4 -3
- data/lib/openstudio/extension.rb +3 -2
- data/lib/openstudio/extension/core/os_lib_geometry.rb +3 -3
- data/lib/openstudio/extension/core/os_lib_hvac.rb +17 -17
- data/lib/openstudio/extension/core/os_lib_model_generation.rb +42 -31
- data/lib/openstudio/extension/core/os_lib_model_simplification.rb +9 -9
- data/lib/openstudio/extension/core/os_lib_outdoorair_and_infiltration.rb +2 -2
- data/lib/openstudio/extension/runner.rb +1 -10
- data/lib/openstudio/extension/version.rb +1 -1
- data/openstudio-extension.gemspec +1 -1
- metadata +5 -6
- data/lib/openstudio/extension/core/os_lib_reporting.rb +0 -4755
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26988c39ed89e37921a6a42330ad8e499571fca8c7fe3c11b626ad7e01fef336
|
4
|
+
data.tar.gz: 94e01bc35378f6a13f6415084c013b5a8667892f1b0924095f5a12e1cbed2d8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d309ada8c6984ef040af1b2b0ace8562bfdddcf12d0f790564d977bdbbd19c2a3191e439de9aba640c053145061b5c99daad6ed028404bd05d31c07bbad14b5
|
7
|
+
data.tar.gz: 77458bd7a6789412d6881a376418b08c694522b1b4e767df0e5a539d0e5ad95aa134b27a101bf29edd0a17b841f46eaf2e4d44c1ec7d109a90c0a33cbb2d50bd
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# OpenStudio Extension Gem
|
2
2
|
|
3
|
-
## Version 0.
|
3
|
+
## Version 0.3.0
|
4
4
|
|
5
|
-
|
5
|
+
* remove the os_lib_reporting.rb helpers. This file is only used for OS reporting measure and should not be shared with other users.
|
6
|
+
* Upgrade dependency to openstudio-workflow gem to `~> 2.1.0`
|
7
|
+
* This version works only with EnergyPlus 9.4 since it depends on OpenStudio workflow `~> 2.1.0`
|
6
8
|
|
7
|
-
- Fixed [#98](https://github.com/NREL/openstudio-extension-gem/issues/98)
|
8
9
|
## Version 0.2.5
|
9
10
|
|
10
11
|
* Support runner options for bundle_install_path and gemfile_path
|
data/lib/openstudio/extension.rb
CHANGED
@@ -91,6 +91,7 @@ module OpenStudio
|
|
91
91
|
|
92
92
|
result << obj
|
93
93
|
end
|
94
|
+
|
94
95
|
return result.uniq
|
95
96
|
end
|
96
97
|
|
@@ -105,7 +106,7 @@ module OpenStudio
|
|
105
106
|
result << dir if dir
|
106
107
|
rescue StandardError
|
107
108
|
end
|
108
|
-
return result.uniq
|
109
|
+
return result.uniq.sort
|
109
110
|
end
|
110
111
|
|
111
112
|
##
|
@@ -119,7 +120,7 @@ module OpenStudio
|
|
119
120
|
result << dir if dir
|
120
121
|
rescue StandardError
|
121
122
|
end
|
122
|
-
return result.uniq
|
123
|
+
return result.uniq.sort
|
123
124
|
end
|
124
125
|
|
125
126
|
##
|
@@ -765,7 +765,7 @@ module OsLib_Geometry
|
|
765
765
|
story_hash.each_with_index do |(story_name, story_data), index|
|
766
766
|
# make new story unless story at requested height already exists.
|
767
767
|
story = nil
|
768
|
-
model.getBuildingStorys.each do |ext_story|
|
768
|
+
model.getBuildingStorys.sort.each do |ext_story|
|
769
769
|
if (ext_story.nominalZCoordinate.to_f - story_data[:space_origin_z].to_f).abs < 0.01
|
770
770
|
story = ext_story
|
771
771
|
end
|
@@ -1133,11 +1133,11 @@ module OsLib_Geometry
|
|
1133
1133
|
# todo - also odd with multi-height spaces
|
1134
1134
|
def self.calculate_perimeter(model)
|
1135
1135
|
perimeter = 0
|
1136
|
-
model.getSpaces.each do |space|
|
1136
|
+
model.getSpaces.sort.each do |space|
|
1137
1137
|
# counter to use later
|
1138
1138
|
edge_hash = {}
|
1139
1139
|
edge_counter = 0
|
1140
|
-
space.surfaces.each do |surface|
|
1140
|
+
space.surfaces.sort.each do |surface|
|
1141
1141
|
# get vertices
|
1142
1142
|
vertex_hash = {}
|
1143
1143
|
vertex_counter = 0
|
@@ -117,7 +117,7 @@ module OsLib_HVAC
|
|
117
117
|
zonesUnconditioned = []
|
118
118
|
|
119
119
|
# get thermal zones
|
120
|
-
zones = model.getThermalZones
|
120
|
+
zones = model.getThermalZones.sort
|
121
121
|
zones.each do |zone|
|
122
122
|
# assign appropriate zones to zonesPlenum or zonesUnconditioned (those that don't have thermostats or zone HVAC equipment)
|
123
123
|
# if not conditioned then add to zonesPlenum or zonesUnconditioned
|
@@ -177,9 +177,9 @@ module OsLib_HVAC
|
|
177
177
|
|
178
178
|
def self.reportConditions(model, runner, condition,extra_string = '')
|
179
179
|
|
180
|
-
airloops = model.getAirLoopHVACs
|
181
|
-
plantLoops = model.getPlantLoops
|
182
|
-
zones = model.getThermalZones
|
180
|
+
airloops = model.getAirLoopHVACs.sort
|
181
|
+
plantLoops = model.getPlantLoops.sort
|
182
|
+
zones = model.getThermalZones.sort
|
183
183
|
|
184
184
|
# count up zone equipment (not counting zone exhaust fans)
|
185
185
|
zoneHasEquip = false
|
@@ -205,9 +205,9 @@ module OsLib_HVAC
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def self.removeEquipment(model, runner)
|
208
|
-
airloops = model.getAirLoopHVACs
|
209
|
-
plantLoops = model.getPlantLoops
|
210
|
-
zones = model.getThermalZones
|
208
|
+
airloops = model.getAirLoopHVACs.sort
|
209
|
+
plantLoops = model.getPlantLoops.sort
|
210
|
+
zones = model.getThermalZones.sort
|
211
211
|
|
212
212
|
# remove all airloops
|
213
213
|
airloops.each(&:remove)
|
@@ -244,7 +244,7 @@ module OsLib_HVAC
|
|
244
244
|
require "#{File.dirname(__FILE__)}/os_lib_schedules"
|
245
245
|
|
246
246
|
schedulesHVAC = {}
|
247
|
-
airloops = model.getAirLoopHVACs
|
247
|
+
airloops = model.getAirLoopHVACs.sort
|
248
248
|
|
249
249
|
# find airloop with most primary spaces
|
250
250
|
max_primary_spaces = 0
|
@@ -628,7 +628,7 @@ module OsLib_HVAC
|
|
628
628
|
|
629
629
|
# check for water-cooled chillers
|
630
630
|
waterCooledChiller = false
|
631
|
-
model.getChillerElectricEIRs.each do |chiller|
|
631
|
+
model.getChillerElectricEIRs.sort.each do |chiller|
|
632
632
|
next if waterCooledChiller == true
|
633
633
|
if chiller.condenserType == 'WaterCooled'
|
634
634
|
waterCooledChiller = true
|
@@ -678,7 +678,7 @@ module OsLib_HVAC
|
|
678
678
|
pipe_supply_outlet.addToNode(condenser_loop.supplyOutletNode)
|
679
679
|
setpoint_manager_follow_oa.addToNode(condenser_loop.supplyOutletNode)
|
680
680
|
# demand side components
|
681
|
-
model.getChillerElectricEIRs.each do |chiller|
|
681
|
+
model.getChillerElectricEIRs.sort.each do |chiller|
|
682
682
|
if chiller.condenserType == 'WaterCooled' # works only if chillers not already connected to condenser loop(s)
|
683
683
|
condenser_loop.addDemandBranchForComponent(chiller)
|
684
684
|
end
|
@@ -771,7 +771,7 @@ module OsLib_HVAC
|
|
771
771
|
primary_airloops = []
|
772
772
|
# create primary airloop for each story
|
773
773
|
assignedThermalZones = []
|
774
|
-
model.getBuildingStorys.each do |building_story|
|
774
|
+
model.getBuildingStorys.sort.each do |building_story|
|
775
775
|
# ML stories need to be reordered from the ground up
|
776
776
|
thermalZonesToAdd = []
|
777
777
|
building_story.spaces.each do |space|
|
@@ -1069,7 +1069,7 @@ module OsLib_HVAC
|
|
1069
1069
|
def self.createSecondaryAirLoops(model, runner, options)
|
1070
1070
|
secondary_airloops = []
|
1071
1071
|
# create secondary airloop for each secondary zone
|
1072
|
-
model.getThermalZones.each do |zone|
|
1072
|
+
model.getThermalZones.sort.each do |zone|
|
1073
1073
|
if options['zonesSecondary'].include? zone
|
1074
1074
|
# create secondary airloop
|
1075
1075
|
airloop_secondary = OpenStudio::Model::AirLoopHVAC.new(model)
|
@@ -1314,7 +1314,7 @@ module OsLib_HVAC
|
|
1314
1314
|
end
|
1315
1315
|
|
1316
1316
|
def self.createPrimaryZoneEquipment(model, runner, options)
|
1317
|
-
model.getThermalZones.each do |zone|
|
1317
|
+
model.getThermalZones.sort.each do |zone|
|
1318
1318
|
if options['zonesPrimary'].include? zone
|
1319
1319
|
if options['zoneHVAC'] == 'FanCoil'
|
1320
1320
|
# create fan coil
|
@@ -1521,7 +1521,7 @@ module OsLib_HVAC
|
|
1521
1521
|
def self.get_or_add_hot_water_loop(model)
|
1522
1522
|
# How water loop
|
1523
1523
|
hw_loop = nil
|
1524
|
-
model.getLoops.each do |loop|
|
1524
|
+
model.getLoops.sort.each do |loop|
|
1525
1525
|
if loop.name.to_s == 'Hot Water Loop' # sizingPlant has loopType method to do this better
|
1526
1526
|
hw_loop = loop.to_PlantLoop.get
|
1527
1527
|
end
|
@@ -1580,7 +1580,7 @@ module OsLib_HVAC
|
|
1580
1580
|
# Chilled Water Plant
|
1581
1581
|
# todo - add in logic here that if existing chw_loop is air cooled, replace it with this one.
|
1582
1582
|
chw_loop = nil
|
1583
|
-
model.getLoops.each do |loop|
|
1583
|
+
model.getLoops.sort.each do |loop|
|
1584
1584
|
if loop.name.to_s == 'Chilled Water Loop'
|
1585
1585
|
chw_loop = loop.to_PlantLoop.get
|
1586
1586
|
end
|
@@ -1658,7 +1658,7 @@ module OsLib_HVAC
|
|
1658
1658
|
|
1659
1659
|
# Condenser System
|
1660
1660
|
cw_loop = nil
|
1661
|
-
model.getLoops.each do |loop|
|
1661
|
+
model.getLoops.sort.each do |loop|
|
1662
1662
|
if loop.name.to_s == 'Condenser Water Loop'
|
1663
1663
|
cw_loop = loop.to_PlantLoop.get
|
1664
1664
|
end
|
@@ -1702,7 +1702,7 @@ module OsLib_HVAC
|
|
1702
1702
|
def self.get_or_add_air_cooled_chiller_loop(model)
|
1703
1703
|
# Chilled Water Plant
|
1704
1704
|
chw_loop = nil
|
1705
|
-
model.getLoops.each do |loop|
|
1705
|
+
model.getLoops.sort.each do |loop|
|
1706
1706
|
if loop.name.to_s == 'Chilled Water Loop'
|
1707
1707
|
chw_loop = loop.to_PlantLoop.get
|
1708
1708
|
end
|
@@ -909,6 +909,7 @@ module OsLib_ModelGeneration
|
|
909
909
|
stories_flat = []
|
910
910
|
stories_flat_counter = 0
|
911
911
|
bar_hash[:stories].each_with_index do |(k, v), i|
|
912
|
+
#runner.registerInfo("STORY: k: #{k}, v: #{v}, index: #{i}")
|
912
913
|
# k is invalid in some cases, old story object that has been removed, should be from low to high including basement
|
913
914
|
# skip if source story insn't included in building area
|
914
915
|
if v[:story_included_in_building_area].nil? || (v[:story_included_in_building_area] == true)
|
@@ -1049,7 +1050,7 @@ module OsLib_ModelGeneration
|
|
1049
1050
|
# only intersect if make_mid_story_surfaces_adiabatic false
|
1050
1051
|
if diagnostic_intersect
|
1051
1052
|
|
1052
|
-
model.getPlanarSurfaces.each do |surface|
|
1053
|
+
model.getPlanarSurfaces.sort.each do |surface|
|
1053
1054
|
array = []
|
1054
1055
|
vertices = surface.vertices
|
1055
1056
|
fixed = false
|
@@ -1075,7 +1076,7 @@ module OsLib_ModelGeneration
|
|
1075
1076
|
end
|
1076
1077
|
|
1077
1078
|
# remove collinear points in a surface
|
1078
|
-
model.getPlanarSurfaces.each do |surface|
|
1079
|
+
model.getPlanarSurfaces.sort.each do |surface|
|
1079
1080
|
new_vertices = OpenStudio.removeCollinear(surface.vertices)
|
1080
1081
|
starting_count = surface.vertices.size
|
1081
1082
|
final_count = new_vertices.size
|
@@ -1086,7 +1087,7 @@ module OsLib_ModelGeneration
|
|
1086
1087
|
end
|
1087
1088
|
|
1088
1089
|
# remove duplicate surfaces in a space (should be done after remove duplicate and collinear points)
|
1089
|
-
model.getSpaces.each do |space|
|
1090
|
+
model.getSpaces.sort.each do |space|
|
1090
1091
|
|
1091
1092
|
# secondary array to compare against
|
1092
1093
|
surfaces_b = space.surfaces.sort
|
@@ -1130,7 +1131,7 @@ module OsLib_ModelGeneration
|
|
1130
1131
|
end
|
1131
1132
|
runner.registerInfo('Intersecting and matching surfaces in model, this will create additional geometry.')
|
1132
1133
|
else #elsif bar_hash[:double_loaded_corridor] # only intersect spaces in each story, not between wtory
|
1133
|
-
model.getBuilding.buildingStories.each do |story|
|
1134
|
+
model.getBuilding.buildingStories.sort.each do |story|
|
1134
1135
|
# intersect and surface match two pair by pair
|
1135
1136
|
spaces_b = story.spaces.sort
|
1136
1137
|
# looping through vector of each space
|
@@ -1161,7 +1162,7 @@ module OsLib_ModelGeneration
|
|
1161
1162
|
runner.registerInfo('Intersecting and matching surfaces in model, this will create additional geometry.')
|
1162
1163
|
end
|
1163
1164
|
else #elsif bar_hash[:double_loaded_corridor] # only intersect spaces in each story, not between wtory
|
1164
|
-
model.getBuilding.buildingStories.each do |story|
|
1165
|
+
model.getBuilding.buildingStories.sort.each do |story|
|
1165
1166
|
story_spaces = OpenStudio::Model::SpaceVector.new
|
1166
1167
|
story.spaces.sort.each do |space|
|
1167
1168
|
story_spaces << space
|
@@ -1177,11 +1178,11 @@ module OsLib_ModelGeneration
|
|
1177
1178
|
# set boundary conditions if not already set when geometry was created
|
1178
1179
|
# todo - update this to use space original z value vs. story name
|
1179
1180
|
if bar_hash[:num_stories_below_grade] > 0
|
1180
|
-
model.getBuildingStorys.each do |story|
|
1181
|
+
model.getBuildingStorys.sort.each do |story|
|
1181
1182
|
next if !story.name.to_s.include?('Story B')
|
1182
|
-
story.spaces.each do |space|
|
1183
|
+
story.spaces.sort.each do |space|
|
1183
1184
|
next if not new_spaces.include?(space)
|
1184
|
-
space.surfaces.each do |surface|
|
1185
|
+
space.surfaces.sort.each do |surface|
|
1185
1186
|
next if surface.surfaceType != 'Wall'
|
1186
1187
|
next if surface.outsideBoundaryCondition != 'Outdoors'
|
1187
1188
|
surface.setOutsideBoundaryCondition('Ground')
|
@@ -1646,10 +1647,7 @@ module OsLib_ModelGeneration
|
|
1646
1647
|
end
|
1647
1648
|
end
|
1648
1649
|
end
|
1649
|
-
|
1650
1650
|
end
|
1651
|
-
|
1652
|
-
|
1653
1651
|
end
|
1654
1652
|
|
1655
1653
|
# bar_from_building_type_ratios
|
@@ -2379,7 +2377,7 @@ module OsLib_ModelGeneration
|
|
2379
2377
|
if args['party_wall_fraction'] > 0
|
2380
2378
|
actual_ext_wall_area = model.getBuilding.exteriorWallArea
|
2381
2379
|
actual_party_wall_area = 0.0
|
2382
|
-
model.getSurfaces.each do |surface|
|
2380
|
+
model.getSurfaces.sort.each do |surface|
|
2383
2381
|
next if surface.outsideBoundaryCondition != 'Adiabatic'
|
2384
2382
|
next if surface.surfaceType != 'Wall'
|
2385
2383
|
actual_party_wall_area += surface.grossArea * surface.space.get.multiplier
|
@@ -2390,7 +2388,7 @@ module OsLib_ModelGeneration
|
|
2390
2388
|
end
|
2391
2389
|
|
2392
2390
|
# check ns/ew aspect ratio (harder to check when party walls are added)
|
2393
|
-
wall_and_window_by_orientation = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model,model.getSpaces)
|
2391
|
+
wall_and_window_by_orientation = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model,model.getSpaces.sort)
|
2394
2392
|
wall_ns = (wall_and_window_by_orientation['northWall'] + wall_and_window_by_orientation['southWall'])
|
2395
2393
|
wall_ew = wall_and_window_by_orientation['eastWall'] + wall_and_window_by_orientation['westWall']
|
2396
2394
|
wall_ns_ip = OpenStudio.convert(wall_ns,'m^2','ft^2').get
|
@@ -2613,7 +2611,7 @@ module OsLib_ModelGeneration
|
|
2613
2611
|
|
2614
2612
|
# remove internal loads
|
2615
2613
|
if args['remove_objects']
|
2616
|
-
model.getSpaceLoads.each do |instance|
|
2614
|
+
model.getSpaceLoads.sort.each do |instance|
|
2617
2615
|
next if instance.name.to_s.include?('Elevator') # most prototype building types model exterior elevators with name Elevator
|
2618
2616
|
next if instance.to_InternalMass.is_initialized
|
2619
2617
|
next if instance.to_WaterUseEquipment.is_initialized
|
@@ -2623,7 +2621,7 @@ module OsLib_ModelGeneration
|
|
2623
2621
|
model.getDefaultScheduleSets.each(&:remove)
|
2624
2622
|
end
|
2625
2623
|
|
2626
|
-
model.getSpaceTypes.each do |space_type|
|
2624
|
+
model.getSpaceTypes.sort.each do |space_type|
|
2627
2625
|
# Don't add infiltration here; will be added later in the script
|
2628
2626
|
test = standard.space_type_apply_internal_loads(space_type, true, true, true, true, true, false)
|
2629
2627
|
if test == false
|
@@ -2642,7 +2640,7 @@ module OsLib_ModelGeneration
|
|
2642
2640
|
|
2643
2641
|
# warn if spaces in model without space type
|
2644
2642
|
spaces_without_space_types = []
|
2645
|
-
model.getSpaces.each do |space|
|
2643
|
+
model.getSpaces.sort.each do |space|
|
2646
2644
|
next if space.spaceType.is_initialized
|
2647
2645
|
spaces_without_space_types << space
|
2648
2646
|
end
|
@@ -2653,7 +2651,7 @@ module OsLib_ModelGeneration
|
|
2653
2651
|
|
2654
2652
|
# identify primary building type (used for construction, and ideally HVAC as well)
|
2655
2653
|
building_types = {}
|
2656
|
-
model.getSpaceTypes.each do |space_type|
|
2654
|
+
model.getSpaceTypes.sort.each do |space_type|
|
2657
2655
|
# populate hash of building types
|
2658
2656
|
if space_type.standardsBuildingType.is_initialized
|
2659
2657
|
bldg_type = space_type.standardsBuildingType.get
|
@@ -2697,7 +2695,7 @@ module OsLib_ModelGeneration
|
|
2697
2695
|
end
|
2698
2696
|
|
2699
2697
|
# address any adiabatic surfaces that don't have hard assigned constructions
|
2700
|
-
model.getSurfaces.each do |surface|
|
2698
|
+
model.getSurfaces.sort.each do |surface|
|
2701
2699
|
next if surface.outsideBoundaryCondition != 'Adiabatic'
|
2702
2700
|
next if surface.construction.is_initialized
|
2703
2701
|
surface.setAdjacentSurface(surface)
|
@@ -2721,11 +2719,11 @@ module OsLib_ModelGeneration
|
|
2721
2719
|
if args['add_elevators']
|
2722
2720
|
|
2723
2721
|
# remove elevators as spaceLoads or exteriorLights
|
2724
|
-
model.getSpaceLoads.each do |instance|
|
2722
|
+
model.getSpaceLoads.sort.each do |instance|
|
2725
2723
|
next if !instance.name.to_s.include?('Elevator') # most prototype building types model exterior elevators with name Elevator
|
2726
2724
|
instance.remove
|
2727
2725
|
end
|
2728
|
-
model.getExteriorLightss.each do |ext_light|
|
2726
|
+
model.getExteriorLightss.sort.each do |ext_light|
|
2729
2727
|
next if !ext_light.name.to_s.include?('Fuel equipment') # some prototype building types model exterior elevators by this name
|
2730
2728
|
ext_light.remove
|
2731
2729
|
end
|
@@ -2746,7 +2744,7 @@ module OsLib_ModelGeneration
|
|
2746
2744
|
if args['add_exterior_lights']
|
2747
2745
|
|
2748
2746
|
if args['remove_objects']
|
2749
|
-
model.getExteriorLightss.each do |ext_light|
|
2747
|
+
model.getExteriorLightss.sort.each do |ext_light|
|
2750
2748
|
next if ext_light.name.to_s.include?('Fuel equipment') # some prototype building types model exterior elevators by this name
|
2751
2749
|
ext_light.remove
|
2752
2750
|
end
|
@@ -2864,7 +2862,7 @@ module OsLib_ModelGeneration
|
|
2864
2862
|
if args['add_internal_mass']
|
2865
2863
|
|
2866
2864
|
if args['remove_objects']
|
2867
|
-
model.getSpaceLoads.each do |instance|
|
2865
|
+
model.getSpaceLoads.sort.each do |instance|
|
2868
2866
|
next unless instance.to_InternalMass.is_initialized
|
2869
2867
|
instance.remove
|
2870
2868
|
end
|
@@ -2887,7 +2885,7 @@ module OsLib_ModelGeneration
|
|
2887
2885
|
model.getThermostatSetpointDualSetpoints.each(&:remove)
|
2888
2886
|
end
|
2889
2887
|
|
2890
|
-
model.getSpaceTypes.each do |space_type|
|
2888
|
+
model.getSpaceTypes.sort.each do |space_type|
|
2891
2889
|
# create thermostat schedules
|
2892
2890
|
# skip un-recognized space types
|
2893
2891
|
next if standard.space_type_get_standards_data(space_type).empty?
|
@@ -2895,12 +2893,12 @@ module OsLib_ModelGeneration
|
|
2895
2893
|
standard.space_type_apply_internal_load_schedules(space_type, false, false, false, false, false, false, true)
|
2896
2894
|
|
2897
2895
|
# identify thermal thermostat and apply to zones (apply_internal_load_schedules names )
|
2898
|
-
model.getThermostatSetpointDualSetpoints.each do |thermostat|
|
2896
|
+
model.getThermostatSetpointDualSetpoints.sort.each do |thermostat|
|
2899
2897
|
next if thermostat.name.to_s != "#{space_type.name} Thermostat"
|
2900
2898
|
next if !thermostat.coolingSetpointTemperatureSchedule.is_initialized
|
2901
2899
|
next if !thermostat.heatingSetpointTemperatureSchedule.is_initialized
|
2902
2900
|
runner.registerInfo("Assigning #{thermostat.name} to thermal zones with #{space_type.name} assigned.")
|
2903
|
-
space_type.spaces.each do |space|
|
2901
|
+
space_type.spaces.sort.each do |space|
|
2904
2902
|
next if !space.thermalZone.is_initialized
|
2905
2903
|
space.thermalZone.get.setThermostatSetpointDualSetpoint(thermostat)
|
2906
2904
|
end
|
@@ -3074,6 +3072,20 @@ module OsLib_ModelGeneration
|
|
3074
3072
|
end
|
3075
3073
|
end
|
3076
3074
|
|
3075
|
+
# add internal mass
|
3076
|
+
if args['add_internal_mass']
|
3077
|
+
|
3078
|
+
if args['remove_objects']
|
3079
|
+
model.getSpaceLoads.sort.each do |instance|
|
3080
|
+
next unless instance.to_InternalMass.is_initialized
|
3081
|
+
instance.remove
|
3082
|
+
end
|
3083
|
+
end
|
3084
|
+
|
3085
|
+
# add internal mass to conditioned spaces; needs to happen after thermostats are applied
|
3086
|
+
standard.model_add_internal_mass(model, primary_bldg_type)
|
3087
|
+
end
|
3088
|
+
|
3077
3089
|
# set unmet hours tolerance
|
3078
3090
|
unmet_hrs_tol_r = args['unmet_hours_tolerance']
|
3079
3091
|
unmet_hrs_tol_k = OpenStudio.convert(unmet_hrs_tol_r, 'R', 'K').get
|
@@ -3117,8 +3129,8 @@ module OsLib_ModelGeneration
|
|
3117
3129
|
set_building_defaults = runner.getBoolArgumentValue('set_building_defaults', user_arguments)
|
3118
3130
|
|
3119
3131
|
# reporting initial condition of model
|
3120
|
-
starting_spaceTypes = model.getSpaceTypes
|
3121
|
-
starting_constructionSets = model.getDefaultConstructionSets
|
3132
|
+
starting_spaceTypes = model.getSpaceTypes.sort
|
3133
|
+
starting_constructionSets = model.getDefaultConstructionSets.sort
|
3122
3134
|
runner.registerInitialCondition("The building started with #{starting_spaceTypes.size} space types and #{starting_constructionSets.size} construction sets.")
|
3123
3135
|
|
3124
3136
|
# lookup space types for specified building type (false indicates not to use whole building type only)
|
@@ -3155,7 +3167,7 @@ module OsLib_ModelGeneration
|
|
3155
3167
|
if create_space_types
|
3156
3168
|
|
3157
3169
|
# array of starting space types
|
3158
|
-
space_types_starting = model.getSpaceTypes
|
3170
|
+
space_types_starting = model.getSpaceTypes.sort
|
3159
3171
|
|
3160
3172
|
# create stub space types
|
3161
3173
|
space_type_hash.each do |space_type_name, hash|
|
@@ -3268,11 +3280,10 @@ module OsLib_ModelGeneration
|
|
3268
3280
|
end
|
3269
3281
|
|
3270
3282
|
# reporting final condition of model
|
3271
|
-
finishing_spaceTypes = model.getSpaceTypes
|
3272
|
-
finishing_constructionSets = model.getDefaultConstructionSets
|
3283
|
+
finishing_spaceTypes = model.getSpaceTypes.sort
|
3284
|
+
finishing_constructionSets = model.getDefaultConstructionSets.sort
|
3273
3285
|
runner.registerFinalCondition("The building finished with #{finishing_spaceTypes.size} space types and #{finishing_constructionSets.size} construction sets.")
|
3274
3286
|
|
3275
3287
|
return true
|
3276
3288
|
end
|
3277
|
-
|
3278
3289
|
end
|
@@ -148,7 +148,7 @@ module OsLib_ModelSimplification
|
|
148
148
|
# loop through building type hash to create multiple blends
|
149
149
|
space_type_hash.each do |collection_name, space_types|
|
150
150
|
if collection_name == 'Building'
|
151
|
-
space_array = model.getSpaces # use all space types, not just space types passed in
|
151
|
+
space_array = model.getSpaces.sort # use all space types, not just space types passed in
|
152
152
|
else
|
153
153
|
space_array = []
|
154
154
|
space_types.each do |space_type|
|
@@ -229,7 +229,7 @@ module OsLib_ModelSimplification
|
|
229
229
|
if collection_name == 'Building'
|
230
230
|
# count area of spaces that have no space type
|
231
231
|
no_space_type_area_counter = 0
|
232
|
-
model.getSpaces.each do |space|
|
232
|
+
model.getSpaces.sort.each do |space|
|
233
233
|
if space.spaceType.empty?
|
234
234
|
next if !space.partofTotalFloorArea
|
235
235
|
no_space_type_area_counter += space.floorArea * space.multiplier
|
@@ -400,7 +400,7 @@ module OsLib_ModelSimplification
|
|
400
400
|
end
|
401
401
|
end
|
402
402
|
|
403
|
-
return model.getSpaceTypes
|
403
|
+
return model.getSpaceTypes.sort
|
404
404
|
end
|
405
405
|
|
406
406
|
# blend internal loads used when working from existing model
|
@@ -788,10 +788,10 @@ module OsLib_ModelSimplification
|
|
788
788
|
def sort_building_stories_and_get_min_multiplier(model)
|
789
789
|
sorted_building_stories = {}
|
790
790
|
# loop through stories
|
791
|
-
model.getBuildingStorys.each do |story|
|
791
|
+
model.getBuildingStorys.sort.each do |story|
|
792
792
|
story_min_z = nil
|
793
793
|
# loop through spaces in story.
|
794
|
-
story.spaces.each do |space|
|
794
|
+
story.spaces.sort.each do |space|
|
795
795
|
space_z_min = OsLib_Geometry.getSurfaceZValues(space.surfaces.to_a).min + space.zOrigin
|
796
796
|
if story_min_z.nil? || (story_min_z > space_z_min)
|
797
797
|
story_min_z = space_z_min
|
@@ -829,8 +829,8 @@ module OsLib_ModelSimplification
|
|
829
829
|
|
830
830
|
# get bounding_box
|
831
831
|
bounding_box = OpenStudio::BoundingBox.new
|
832
|
-
model.getSpaces.each do |space|
|
833
|
-
space.surfaces.each do |spaceSurface|
|
832
|
+
model.getSpaces.sort.each do |space|
|
833
|
+
space.surfaces.sort.each do |spaceSurface|
|
834
834
|
bounding_box.addPoints(space.transformation * spaceSurface.vertices)
|
835
835
|
end
|
836
836
|
end
|
@@ -844,7 +844,7 @@ module OsLib_ModelSimplification
|
|
844
844
|
envelope_data_hash[:building_max_xyz] = [max_x, max_y, max_z]
|
845
845
|
|
846
846
|
# add orientation specific wwr
|
847
|
-
ext_surfaces_hash = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model, model.getSpaces.to_a)
|
847
|
+
ext_surfaces_hash = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model, model.getSpaces.sort.to_a)
|
848
848
|
envelope_data_hash[:building_wwr_n] = ext_surfaces_hash['northWindow'] / ext_surfaces_hash['northWall']
|
849
849
|
envelope_data_hash[:building_wwr_s] = ext_surfaces_hash['southWindow'] / ext_surfaces_hash['southWall']
|
850
850
|
envelope_data_hash[:building_wwr_e] = ext_surfaces_hash['eastWindow'] / ext_surfaces_hash['eastWall']
|
@@ -1038,7 +1038,7 @@ module OsLib_ModelSimplification
|
|
1038
1038
|
envelope_data_hash[:building_overhang_proj_factor_w] = building_overhang_area_w / ext_surfaces_hash['westWindow']
|
1039
1039
|
|
1040
1040
|
# warn for spaces that are not on a story (in future could infer stories for these)
|
1041
|
-
model.getSpaces.each do |space|
|
1041
|
+
model.getSpaces.sort.each do |space|
|
1042
1042
|
if !space.buildingStory.is_initialized
|
1043
1043
|
runner.registerWarning("#{space.name} is not on a building story, may have unexpected results.")
|
1044
1044
|
end
|