buildingsync 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/continuous_integration.yml +146 -0
  3. data/.gitignore +33 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +10 -0
  6. data/CHANGELOG.md +50 -0
  7. data/Gemfile +31 -0
  8. data/Jenkinsfile +10 -0
  9. data/LICENSE.md +29 -0
  10. data/README.md +105 -0
  11. data/Rakefile +77 -0
  12. data/bin/console +15 -0
  13. data/bin/setup +8 -0
  14. data/buildingsync.gemspec +37 -0
  15. data/config.rb.in +26 -0
  16. data/doc_templates/LICENSE.md +29 -0
  17. data/doc_templates/README.md.erb +42 -0
  18. data/doc_templates/copyright_erb.txt +38 -0
  19. data/doc_templates/copyright_js.txt +5 -0
  20. data/doc_templates/copyright_ruby.txt +36 -0
  21. data/lib/buildingsync.rb +43 -0
  22. data/lib/buildingsync/all_resource_total.rb +54 -0
  23. data/lib/buildingsync/audit_date.rb +54 -0
  24. data/lib/buildingsync/constants.rb +49 -0
  25. data/lib/buildingsync/contact.rb +54 -0
  26. data/lib/buildingsync/extension.rb +57 -0
  27. data/lib/buildingsync/generator.rb +584 -0
  28. data/lib/buildingsync/get_bcl_weather_file.rb +326 -0
  29. data/lib/buildingsync/helpers/Model.hvac.rb +216 -0
  30. data/lib/buildingsync/helpers/helper.rb +494 -0
  31. data/lib/buildingsync/helpers/xml_get_set.rb +215 -0
  32. data/lib/buildingsync/makers/phase_zero_base.osw +178 -0
  33. data/lib/buildingsync/makers/workflow_maker.json +811 -0
  34. data/lib/buildingsync/makers/workflow_maker.rb +581 -0
  35. data/lib/buildingsync/makers/workflow_maker_base.rb +167 -0
  36. data/lib/buildingsync/model_articulation/building.rb +1119 -0
  37. data/lib/buildingsync/model_articulation/building_and_system_types.json +121 -0
  38. data/lib/buildingsync/model_articulation/building_section.rb +190 -0
  39. data/lib/buildingsync/model_articulation/building_system.rb +49 -0
  40. data/lib/buildingsync/model_articulation/envelope_system.rb +102 -0
  41. data/lib/buildingsync/model_articulation/exterior_floor_system_type.rb +64 -0
  42. data/lib/buildingsync/model_articulation/facility.rb +439 -0
  43. data/lib/buildingsync/model_articulation/foundation_system_type.rb +64 -0
  44. data/lib/buildingsync/model_articulation/hvac_system.rb +395 -0
  45. data/lib/buildingsync/model_articulation/lighting_system.rb +102 -0
  46. data/lib/buildingsync/model_articulation/loads_system.rb +287 -0
  47. data/lib/buildingsync/model_articulation/location_element.rb +129 -0
  48. data/lib/buildingsync/model_articulation/measure.rb +57 -0
  49. data/lib/buildingsync/model_articulation/roof_system_type.rb +64 -0
  50. data/lib/buildingsync/model_articulation/service_hot_water_system.rb +87 -0
  51. data/lib/buildingsync/model_articulation/site.rb +242 -0
  52. data/lib/buildingsync/model_articulation/spatial_element.rb +343 -0
  53. data/lib/buildingsync/model_articulation/wall_system_type.rb +64 -0
  54. data/lib/buildingsync/report.rb +217 -0
  55. data/lib/buildingsync/resource_use.rb +55 -0
  56. data/lib/buildingsync/scenario.rb +622 -0
  57. data/lib/buildingsync/selection_tool.rb +98 -0
  58. data/lib/buildingsync/time_series.rb +85 -0
  59. data/lib/buildingsync/translator.rb +167 -0
  60. data/lib/buildingsync/utility.rb +67 -0
  61. data/lib/buildingsync/version.rb +45 -0
  62. metadata +223 -0
@@ -0,0 +1,121 @@
1
+ {
2
+ "Retail": [{
3
+ "standards_building_type": "RetailStandalone",
4
+ "bar_division_method": "Multiple Space Types - Individual Stories Sliced",
5
+ "system_type": "PSZ-AC with gas coil heat"
6
+ }],
7
+ "Office": [
8
+ {
9
+ "standards_building_type": "SmallOffice",
10
+ "bar_division_method": "Single Space Type - Core and Perimeter",
11
+ "system_type": "PSZ-AC with gas coil heat",
12
+ "max_floor_area": "20000"
13
+ },
14
+ {
15
+ "standards_building_type": "MediumOffice",
16
+ "bar_division_method": "Single Space Type - Core and Perimeter",
17
+ "system_type": "PVAV with reheat",
18
+ "min_floor_area": "20000",
19
+ "max_floor_area": "75000"
20
+ },
21
+ {
22
+ "standards_building_type": "LargeOffice",
23
+ "bar_division_method": "Single Space Type - Core and Perimeter",
24
+ "system_type": "VAV with reheat",
25
+ "min_floor_area": "75000"
26
+ }
27
+ ],
28
+ "StripMall": [{
29
+ "standards_building_type": "RetailStripmall",
30
+ "bar_division_method": "Single Space Type - Core and Perimeter",
31
+ "system_type": "PSZ-AC with gas coil heat"
32
+ }],
33
+ "Education-Primary": [{
34
+ "standards_building_type": "PrimarySchool",
35
+ "bar_division_method": "Single Space Type - Core and Perimeter",
36
+ "system_type": "PVAV with reheat"
37
+ }],
38
+ "Education-Secondary": [{
39
+ "standards_building_type": "SecondarySchool",
40
+ "bar_division_method": "Single Space Type - Core and Perimeter",
41
+ "system_type": "VAV with reheat"
42
+ }],
43
+ "Health care-Outpatient rehabilitation": [{
44
+ "standards_building_type": "Outpatient",
45
+ "bar_division_method": "Single Space Type - Core and Perimeter",
46
+ "system_type": "PVAV with reheat"
47
+ }],
48
+ "Health care-Outpatient facility": [{
49
+ "standards_building_type": "Outpatient",
50
+ "bar_division_method": "Single Space Type - Core and Perimeter",
51
+ "system_type": "PVAV with reheat"
52
+ }],
53
+ "Health care-Outpatient non-diagnostic": [{
54
+ "standards_building_type": "Outpatient",
55
+ "bar_division_method": "Single Space Type - Core and Perimeter",
56
+ "system_type": "PVAV with reheat"
57
+ }],
58
+ "Health care-Outpatient surgical": [{
59
+ "standards_building_type": "Outpatient",
60
+ "bar_division_method": "Single Space Type - Core and Perimeter",
61
+ "system_type": "PVAV with reheat"
62
+ }],
63
+ "Health care-Inpatient hospital": [{
64
+ "standards_building_type": "Hospital",
65
+ "bar_division_method": "Single Space Type - Core and Perimeter",
66
+ "system_type": "VAV with reheat"
67
+ }],
68
+ "Lodging": [
69
+ {
70
+ "standards_building_type": "SmallHotel",
71
+ "bar_division_method": "Single Space Type - Core and Perimeter",
72
+ "system_type": "PTAC with electric baseboard heat",
73
+ "max_floor_area": "50000"
74
+ },
75
+ {
76
+ "standards_building_type": "LargeHotel",
77
+ "bar_division_method": "Single Space Type - Core and Perimeter",
78
+ "system_type": "VAV with reheat",
79
+ "min_floor_area": "50000"
80
+ }
81
+ ],
82
+ "Food service-Fast": [{
83
+ "standards_building_type": "QuickServiceRestaurant",
84
+ "bar_division_method": "Single Space Type - Core and Perimeter",
85
+ "system_type": "PSZ-AC with gas coil heat"
86
+ }],
87
+ "Food service-Full": [{
88
+ "standards_building_type": "FullServiceRestaurant",
89
+ "bar_division_method": "Single Space Type - Core and Perimeter",
90
+ "system_type": "PSZ-AC with gas coil heat"
91
+ }],
92
+ "Food service": [{
93
+ "standards_building_type": "FullServiceRestaurant",
94
+ "bar_division_method": "Single Space Type - Core and Perimeter",
95
+ "system_type": "PSZ-AC with gas coil heat"
96
+ }],
97
+ "Multifamily": [
98
+ {
99
+ "standards_building_type": "MidriseApartment",
100
+ "bar_division_method": "Single Space Type - Core and Perimeter",
101
+ "system_type": "PTAC",
102
+ "max_number_floors": "10"
103
+ },
104
+ {
105
+ "standards_building_type": "HighriseApartment",
106
+ "bar_division_method": "Single Space Type - Core and Perimeter",
107
+ "system_type": "PSZ-HP",
108
+ "min_number_floors": "10"
109
+ }
110
+ ],
111
+ "Warehouse": [{
112
+ "standards_building_type": "Warehouse",
113
+ "bar_division_method": "Single Space Type - Core and Perimeter",
114
+ "system_type": "PSZ-AC with gas coil heat"
115
+ }],
116
+ "Food sales-Grocery store": [{
117
+ "standards_building_type": "SuperMarket",
118
+ "bar_division_method": "Single Space Type - Core and Perimeter",
119
+ "system_type": "PSZ-AC with gas coil heat"
120
+ }]
121
+ }
@@ -0,0 +1,190 @@
1
+ # frozen_string_literal: true
2
+
3
+ # *******************************************************************************
4
+ # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
5
+ # BuildingSync(R), Copyright (c) 2015-2020, Alliance for Sustainable Energy, LLC.
6
+ # All rights reserved.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions are met:
10
+ #
11
+ # (1) Redistributions of source code must retain the above copyright notice,
12
+ # this list of conditions and the following disclaimer.
13
+ #
14
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
15
+ # this list of conditions and the following disclaimer in the documentation
16
+ # and/or other materials provided with the distribution.
17
+ #
18
+ # (3) Neither the name of the copyright holder nor the names of any contributors
19
+ # may be used to endorse or promote products derived from this software without
20
+ # specific prior written permission from the respective party.
21
+ #
22
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
23
+ # of modifications or other derivative works may not use the "OpenStudio"
24
+ # trademark, "OS", "os", or any other confusingly similar designation without
25
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
26
+ #
27
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
28
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
31
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
32
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
34
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ # *******************************************************************************
39
+ require 'openstudio-standards'
40
+
41
+ require 'buildingsync/constants'
42
+ require 'buildingsync/helpers/helper'
43
+
44
+ module BuildingSync
45
+ # BuildingSection class
46
+ class BuildingSection < SpatialElement
47
+ include OpenstudioStandards
48
+ include BuildingSync::Helper
49
+ include BuildingSync::XmlGetSet
50
+ # initialize
51
+ # @param base_xml [REXML:Element] an element corresponding to a single auc:Section
52
+ # @param bldgsync_occ_type [String] Office, Retail, etc.
53
+ # @param building_total_floor_area [Float]
54
+ # @param num_stories [Float]
55
+ # @param ns [String] namespace, likely 'auc'
56
+ def initialize(base_xml, building_occupancy_classification, building_total_floor_area, num_stories, ns)
57
+ super(base_xml, ns)
58
+ @base_xml = base_xml
59
+ @ns = ns
60
+
61
+ help_element_class_type_check(base_xml, 'Section')
62
+
63
+ @door_ids = []
64
+ @wall_ids = []
65
+ @window_ids = []
66
+ @roof_ids = []
67
+ @skylight_ids = []
68
+ @exterior_floor_ids = []
69
+ @foundation_ids = []
70
+
71
+ # parameter to read and write.
72
+ @fraction_area = nil
73
+ @standards_building_type = nil
74
+ @occupancy_classification_original = nil
75
+ @typical_occupant_usage_value_hours = nil
76
+ @typical_occupant_usage_value_weeks = nil
77
+ @occupant_quantity = nil
78
+ @principal_hvac_type = nil
79
+ @num_stories = num_stories
80
+
81
+ @total_floor_area = read_floor_areas(building_total_floor_area)
82
+ xset_or_create('OccupancyClassification', building_occupancy_classification, false)
83
+
84
+ # code to initialize
85
+ read_xml
86
+ end
87
+
88
+ # read xml
89
+ # @param building_occupancy_classification [String]
90
+ # @param building_total_floor_area [Float]
91
+ def read_xml
92
+ # floor areas
93
+ # based on the occupancy type set building type, system type and bar division method
94
+ read_building_section_other_detail
95
+ read_construction_types
96
+
97
+ if @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"]
98
+ @occupant_quantity = @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"].text
99
+ else
100
+ @occupant_quantity = nil
101
+ end
102
+ end
103
+
104
+ # read building section other details
105
+ def read_building_section_other_detail
106
+ if @base_xml.elements["#{@ns}:TypicalOccupantUsages"]
107
+ @base_xml.elements.each("#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage") do |occ_usage|
108
+ if occ_usage.elements["#{@ns}:TypicalOccupantUsageUnits"].text == 'Hours per week'
109
+ @typical_occupant_usage_value_hours = occ_usage.elements["#{@ns}:TypicalOccupantUsageValue"].text
110
+ elsif occ_usage.elements["#{@ns}:TypicalOccupantUsageUnits"].text == 'Weeks per year'
111
+ @typical_occupant_usage_value_weeks = occ_usage.elements["#{@ns}:TypicalOccupantUsageValue"].text
112
+ end
113
+ end
114
+ end
115
+
116
+ if @base_xml.elements["#{@ns}:OccupancyLevels"]
117
+ @base_xml.elements.each("#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel") do |occ_level|
118
+ if occ_level.elements["#{@ns}:OccupantQuantityType"].text == 'Peak total occupants'
119
+ @occupant_quantity = occ_level.elements["#{@ns}:OccupantQuantity"].text
120
+ end
121
+ end
122
+ end
123
+ end
124
+
125
+ # read construction types
126
+ def read_construction_types
127
+ if @base_xml.elements["#{@ns}:Sides"]
128
+ @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:DoorID") do |door|
129
+ @door_ids.push(door.attributes['IDref'])
130
+ end
131
+ @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:WallID") do |wall|
132
+ @wall_ids.push(wall.attributes['IDref'])
133
+ end
134
+ @base_xml.elements.each("#{@ns}:Sides/#{@ns}:Side/#{@ns}:WindowID") do |window|
135
+ @window_ids.push(window.attributes['IDref'])
136
+ end
137
+ end
138
+ if @base_xml.elements["#{@ns}:Roofs"]
139
+ @base_xml.elements.each("#{@ns}:Roofs/#{@ns}:Roof/#{@ns}:RoofID") do |roof|
140
+ @roof_ids.push(roof.attributes['IDref'])
141
+ end
142
+ @base_xml.elements.each("#{@ns}:Roofs/#{@ns}:Roof/#{@ns}:RoofID/#{@ns}:SkylightIDs/#{@ns}:SkylightID") do |skylight|
143
+ @skylight_ids.push(skylight.attributes['IDref'])
144
+ end
145
+ end
146
+ if @base_xml.elements["#{@ns}:ExteriorFloors"]
147
+ @base_xml.elements.each("#{@ns}:ExteriorFloors/#{@ns}:ExteriorFloor/#{@ns}:ExteriorFloorID ") do |floor|
148
+ @exterior_floor_ids.push(floor.attributes['IDref'])
149
+ end
150
+ end
151
+ if @base_xml.elements["#{@ns}:Foundations"]
152
+ @base_xml.elements.each("#{@ns}:Foundations/#{@ns}:Foundation/#{@ns}:FoundationID ") do |foundation|
153
+ @foundation_ids.push(foundation.attributes['IDref'])
154
+ end
155
+ end
156
+ end
157
+
158
+ # add principal hvac type
159
+ def prepare_final_xml
160
+ @base_xml.elements["#{@ns}:fraction_area"].text = @fraction_area
161
+ @base_xml.elements["#{@ns}:OriginalOccupancyClassification"].text = @occupancy_classification_original if !@occupancy_classification_original.nil?
162
+
163
+ @base_xml.elements["#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage/#{@ns}:TypicalOccupantUsageValue"].text = @typical_occupant_usage_value_hours if !@typical_occupant_usage_value_hours.nil?
164
+ @base_xml.elements["#{@ns}:TypicalOccupantUsages/#{@ns}:TypicalOccupantUsage/#{@ns}:TypicalOccupantUsageValue"].text = @typical_occupant_usage_value_weeks if !@typical_occupant_usage_value_weeks.nil?
165
+ @base_xml.elements["#{@ns}:OccupancyLevels/#{@ns}:OccupancyLevel/#{@ns}:OccupantQuantity"].text = @occupant_quantity if !@occupant_quantity.nil?
166
+
167
+ prepare_final_xml_for_spatial_element
168
+ end
169
+
170
+ # set building and system type
171
+ def set_bldg_and_system_type
172
+ super(xget_text('OccupancyClassification'), @total_floor_area, @number_floors, false)
173
+ end
174
+
175
+ # get peak occupancy
176
+ # @return [String]
177
+ def get_peak_occupancy
178
+ return @occupant_quantity
179
+ end
180
+
181
+ # get floor area of this building section
182
+ # @return [Float]
183
+ def get_floor_area
184
+ return @total_floor_area
185
+ end
186
+
187
+ attr_reader :space_types_floor_area, :occupancy_classification, :typical_occupant_usage_value_weeks, :typical_occupant_usage_value_hours, :standards_building_type, :section_type, :id
188
+ attr_accessor :fraction_area
189
+ end
190
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # *******************************************************************************
4
+ # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
5
+ # BuildingSync(R), Copyright (c) 2015-2020, Alliance for Sustainable Energy, LLC.
6
+ # All rights reserved.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions are met:
10
+ #
11
+ # (1) Redistributions of source code must retain the above copyright notice,
12
+ # this list of conditions and the following disclaimer.
13
+ #
14
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
15
+ # this list of conditions and the following disclaimer in the documentation
16
+ # and/or other materials provided with the distribution.
17
+ #
18
+ # (3) Neither the name of the copyright holder nor the names of any contributors
19
+ # may be used to endorse or promote products derived from this software without
20
+ # specific prior written permission from the respective party.
21
+ #
22
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
23
+ # of modifications or other derivative works may not use the "OpenStudio"
24
+ # trademark, "OS", "os", or any other confusingly similar designation without
25
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
26
+ #
27
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
28
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
31
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
32
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
34
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ # *******************************************************************************
39
+ require 'buildingsync/helpers/helper'
40
+ require 'buildingsync/helpers/xml_get_set'
41
+
42
+ module BuildingSync
43
+ # BuildingSystem class to share functionality between system classes
44
+ class BuildingSystem
45
+ # no features here yet
46
+ include BuildingSync::Helper
47
+ include BuildingSync::XmlGetSet
48
+ end
49
+ end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # *******************************************************************************
4
+ # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
5
+ # BuildingSync(R), Copyright (c) 2015-2020, Alliance for Sustainable Energy, LLC.
6
+ # All rights reserved.
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions are met:
10
+ #
11
+ # (1) Redistributions of source code must retain the above copyright notice,
12
+ # this list of conditions and the following disclaimer.
13
+ #
14
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
15
+ # this list of conditions and the following disclaimer in the documentation
16
+ # and/or other materials provided with the distribution.
17
+ #
18
+ # (3) Neither the name of the copyright holder nor the names of any contributors
19
+ # may be used to endorse or promote products derived from this software without
20
+ # specific prior written permission from the respective party.
21
+ #
22
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
23
+ # of modifications or other derivative works may not use the "OpenStudio"
24
+ # trademark, "OS", "os", or any other confusingly similar designation without
25
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
26
+ #
27
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
28
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
31
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
32
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
34
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
+ # *******************************************************************************
39
+ require_relative 'building_system'
40
+ module BuildingSync
41
+ # EnvelopeSystem class
42
+ class EnvelopeSystem < BuildingSystem
43
+ # initialize
44
+ def initialize
45
+ # code to initialize
46
+ end
47
+
48
+ # add internal loads from standard definitions
49
+ # @param model [OpenStudio::Model]
50
+ # @param standard [Standard]
51
+ # @param primary_bldg_type [String]
52
+ # @param lookup_building_type [String]
53
+ # @param remove_objects [Boolean]
54
+ # @return [Boolean]
55
+ def create(model, standard, primary_bldg_type, lookup_building_type, remove_objects)
56
+ # remove default construction sets
57
+ if remove_objects
58
+ model.getDefaultConstructionSets.each(&:remove)
59
+ end
60
+
61
+ # TODO: - allow building type and space type specific constructions set selection.
62
+ if ['SmallHotel', 'LargeHotel', 'MidriseApartment', 'HighriseApartment'].include?(primary_bldg_type)
63
+ is_residential = 'Yes'
64
+ else
65
+ is_residential = 'No'
66
+ end
67
+ climate_zone = standard.model_get_building_climate_zone_and_building_type(model)['climate_zone']
68
+ OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Facility.create_building_system', 'Could not find climate zone in the model. Verify that the climate zone is set in the BuildingSync File or can be derived from other inputs.') if climate_zone.nil?
69
+ bldg_def_const_set = standard.model_add_construction_set(model, climate_zone, lookup_building_type, nil, is_residential)
70
+ if bldg_def_const_set.is_initialized
71
+ bldg_def_const_set = bldg_def_const_set.get
72
+ if is_residential then bldg_def_const_set.setName("Res #{bldg_def_const_set.name}") end
73
+ model.getBuilding.setDefaultConstructionSet(bldg_def_const_set)
74
+ OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding default construction set named #{bldg_def_const_set.name}")
75
+ puts "Adding default construction set named #{bldg_def_const_set.name} in climate zone #{climate_zone}"
76
+ else
77
+ OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Facility.create_building_system', "Could not create default construction set for the building type #{lookup_building_type} in climate zone #{climate_zone}.")
78
+ return false
79
+ end
80
+
81
+ # address any adiabatic surfaces that don't have hard assigned constructions
82
+ model.getSurfaces.each do |surface|
83
+ next if surface.outsideBoundaryCondition != 'Adiabatic'
84
+ next if surface.construction.is_initialized
85
+
86
+ surface.setAdjacentSurface(surface)
87
+ surface.setConstruction(surface.construction.get)
88
+ surface.setOutsideBoundaryCondition('Adiabatic')
89
+ end
90
+
91
+ # Modify the infiltration rates
92
+ if remove_objects
93
+ model.getSpaceInfiltrationDesignFlowRates.each(&:remove)
94
+ end
95
+ standard.model_apply_infiltration_standard(model)
96
+ standard.model_modify_infiltration_coefficients(model, primary_bldg_type, climate_zone)
97
+
98
+ # set ground temperatures from DOE prototype buildings
99
+ standard.model_add_ground_temperatures(model, primary_bldg_type, climate_zone)
100
+ end
101
+ end
102
+ end