buildingsync 0.2.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 +7 -0
- data/.github/workflows/continuous_integration.yml +146 -0
- data/.gitignore +33 -0
- data/.rspec +3 -0
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +50 -0
- data/Gemfile +31 -0
- data/Jenkinsfile +10 -0
- data/LICENSE.md +29 -0
- data/README.md +105 -0
- data/Rakefile +77 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/buildingsync.gemspec +37 -0
- data/config.rb.in +26 -0
- data/doc_templates/LICENSE.md +29 -0
- data/doc_templates/README.md.erb +42 -0
- data/doc_templates/copyright_erb.txt +38 -0
- data/doc_templates/copyright_js.txt +5 -0
- data/doc_templates/copyright_ruby.txt +36 -0
- data/lib/buildingsync.rb +43 -0
- data/lib/buildingsync/all_resource_total.rb +54 -0
- data/lib/buildingsync/audit_date.rb +54 -0
- data/lib/buildingsync/constants.rb +49 -0
- data/lib/buildingsync/contact.rb +54 -0
- data/lib/buildingsync/extension.rb +57 -0
- data/lib/buildingsync/generator.rb +584 -0
- data/lib/buildingsync/get_bcl_weather_file.rb +326 -0
- data/lib/buildingsync/helpers/Model.hvac.rb +216 -0
- data/lib/buildingsync/helpers/helper.rb +494 -0
- data/lib/buildingsync/helpers/xml_get_set.rb +215 -0
- data/lib/buildingsync/makers/phase_zero_base.osw +178 -0
- data/lib/buildingsync/makers/workflow_maker.json +811 -0
- data/lib/buildingsync/makers/workflow_maker.rb +581 -0
- data/lib/buildingsync/makers/workflow_maker_base.rb +167 -0
- data/lib/buildingsync/model_articulation/building.rb +1119 -0
- data/lib/buildingsync/model_articulation/building_and_system_types.json +121 -0
- data/lib/buildingsync/model_articulation/building_section.rb +190 -0
- data/lib/buildingsync/model_articulation/building_system.rb +49 -0
- data/lib/buildingsync/model_articulation/envelope_system.rb +102 -0
- data/lib/buildingsync/model_articulation/exterior_floor_system_type.rb +64 -0
- data/lib/buildingsync/model_articulation/facility.rb +439 -0
- data/lib/buildingsync/model_articulation/foundation_system_type.rb +64 -0
- data/lib/buildingsync/model_articulation/hvac_system.rb +395 -0
- data/lib/buildingsync/model_articulation/lighting_system.rb +102 -0
- data/lib/buildingsync/model_articulation/loads_system.rb +287 -0
- data/lib/buildingsync/model_articulation/location_element.rb +129 -0
- data/lib/buildingsync/model_articulation/measure.rb +57 -0
- data/lib/buildingsync/model_articulation/roof_system_type.rb +64 -0
- data/lib/buildingsync/model_articulation/service_hot_water_system.rb +87 -0
- data/lib/buildingsync/model_articulation/site.rb +242 -0
- data/lib/buildingsync/model_articulation/spatial_element.rb +343 -0
- data/lib/buildingsync/model_articulation/wall_system_type.rb +64 -0
- data/lib/buildingsync/report.rb +217 -0
- data/lib/buildingsync/resource_use.rb +55 -0
- data/lib/buildingsync/scenario.rb +622 -0
- data/lib/buildingsync/selection_tool.rb +98 -0
- data/lib/buildingsync/time_series.rb +85 -0
- data/lib/buildingsync/translator.rb +167 -0
- data/lib/buildingsync/utility.rb +67 -0
- data/lib/buildingsync/version.rb +45 -0
- metadata +223 -0
@@ -0,0 +1,57 @@
|
|
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
|
+
# Measure class
|
44
|
+
class Measure
|
45
|
+
include BuildingSync::Helper
|
46
|
+
include BuildingSync::XmlGetSet
|
47
|
+
# initialize
|
48
|
+
# @param @base_xml [REXML::Element]
|
49
|
+
# @param ns [String]
|
50
|
+
def initialize(base_xml, ns)
|
51
|
+
@base_xml = base_xml
|
52
|
+
@ns = ns
|
53
|
+
|
54
|
+
help_element_class_type_check(base_xml, 'Measure')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,64 @@
|
|
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
|
+
|
40
|
+
module BuildingSync
|
41
|
+
# Roof System Type
|
42
|
+
class RoofSystemType
|
43
|
+
# initialize a specific floor system type given a ref
|
44
|
+
# @param doc [REXML::Document]
|
45
|
+
# @param ns [String]
|
46
|
+
# @param ref [String]
|
47
|
+
def initialize(doc, ns, ref)
|
48
|
+
@id = nil
|
49
|
+
doc.elements.each("#{ns}:Systems/#{ns}:RoofSystems/#{ns}:RoofSystem") do |roof_system|
|
50
|
+
if roof_system.attributes['ID'] == ref
|
51
|
+
read(roof_system, ns)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# read
|
57
|
+
# @param roof_system [REXML:Element]
|
58
|
+
# @param ns [String]
|
59
|
+
def read(roof_system, ns)
|
60
|
+
# ID
|
61
|
+
@id = roof_system.attributes['ID'] if roof_system.attributes['ID']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,87 @@
|
|
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
|
+
module BuildingSync
|
40
|
+
# ServiceHotWaterSystem class to add a SHW system to the model
|
41
|
+
class ServiceHotWaterSystem < BuildingSystem
|
42
|
+
# initialize
|
43
|
+
def initialize
|
44
|
+
# code to initialize
|
45
|
+
end
|
46
|
+
|
47
|
+
# add
|
48
|
+
# @param model [OpenStudio::Model]
|
49
|
+
# @param standard [Standard]
|
50
|
+
# @param remove_objects [Boolean]
|
51
|
+
# @return [Boolean]
|
52
|
+
def add(model, standard, remove_objects)
|
53
|
+
# remove water use equipment and water use connections
|
54
|
+
if remove_objects
|
55
|
+
# TODO: - remove plant loops used for service water heating
|
56
|
+
model.getWaterUseEquipments.each(&:remove)
|
57
|
+
model.getWaterUseConnectionss.each(&:remove)
|
58
|
+
end
|
59
|
+
|
60
|
+
typical_swh = standard.model_add_typical_swh(model)
|
61
|
+
mid_rise_swh_loops = []
|
62
|
+
strip_mall_swh_loops = []
|
63
|
+
typical_swh.each do |loop|
|
64
|
+
if loop.name.get.include?('MidriseApartment')
|
65
|
+
mid_rise_swh_loops << loop
|
66
|
+
elsif loop.name.get.include?('RetailStripmall')
|
67
|
+
strip_mall_swh_loops << loop
|
68
|
+
else
|
69
|
+
water_use_connections = []
|
70
|
+
loop.demandComponents.each do |component|
|
71
|
+
next if !component.to_WaterUseConnections.is_initialized
|
72
|
+
|
73
|
+
water_use_connections << component
|
74
|
+
end
|
75
|
+
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{loop.name} to the building. It has #{water_use_connections.size} water use connections.")
|
76
|
+
end
|
77
|
+
end
|
78
|
+
if !mid_rise_swh_loops.empty?
|
79
|
+
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{mid_rise_swh_loops.size} MidriseApartment service water heating loops.")
|
80
|
+
end
|
81
|
+
if !strip_mall_swh_loops.empty?
|
82
|
+
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Facility.create_building_system', "Adding #{strip_mall_swh_loops.size} RetailStripmall service water heating loops.")
|
83
|
+
end
|
84
|
+
return true
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,242 @@
|
|
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'
|
40
|
+
module BuildingSync
|
41
|
+
# Site class
|
42
|
+
class Site < LocationElement
|
43
|
+
# initialize
|
44
|
+
# @param base_xml [REXML::Element] an element corresponding to a single auc:Site
|
45
|
+
# @param ns [String] namespace, likely 'auc'
|
46
|
+
def initialize(base_xml, ns)
|
47
|
+
super(base_xml, ns)
|
48
|
+
@base_xml = base_xml
|
49
|
+
@ns = ns
|
50
|
+
help_element_class_type_check(base_xml, 'Site')
|
51
|
+
|
52
|
+
@building = nil
|
53
|
+
@all_set = false
|
54
|
+
|
55
|
+
# using the XML snippet to search for the buildings on the site
|
56
|
+
read_xml
|
57
|
+
end
|
58
|
+
|
59
|
+
# read xml
|
60
|
+
def read_xml
|
61
|
+
# first we check if the number of buildings is ok
|
62
|
+
building_xml_temp = @base_xml.get_elements("#{@ns}:Buildings/#{@ns}:Building")
|
63
|
+
|
64
|
+
if building_xml_temp.nil? || building_xml_temp.empty?
|
65
|
+
OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Site.read_xml', "Site with ID: #{xget_id} has no Building elements. Cannot initialize Site.")
|
66
|
+
raise StandardError, "Site with ID: #{xget_id} has no Building elements. Cannot initialize Site."
|
67
|
+
elsif building_xml_temp.size > 1
|
68
|
+
@building_xml = building_xml_temp.first
|
69
|
+
OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Site.read_xml', "Site ID: #{xget_id}. There is more than one (#{building_xml_temp.size}) Building elements. Only the first Building will be considered (ID: #{@building_xml.attributes['ID']}.")
|
70
|
+
else
|
71
|
+
@building_xml = building_xml_temp.first
|
72
|
+
end
|
73
|
+
|
74
|
+
# read other data
|
75
|
+
@total_floor_area = read_floor_areas(nil)
|
76
|
+
read_location_values
|
77
|
+
|
78
|
+
@building = BuildingSync::Building.new(@building_xml, xget_text('OccupancyClassification'), @total_floor_area, @ns)
|
79
|
+
end
|
80
|
+
|
81
|
+
# set all function to set all parameters for each building
|
82
|
+
def set_all
|
83
|
+
if !@all_set
|
84
|
+
@all_set = true
|
85
|
+
@building.set_all
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# build zone hash that stores zone lists for buildings and building sections
|
90
|
+
# @return [hash<string, array<OpenStudio::Model::ThermalZone>>]
|
91
|
+
def build_zone_hash
|
92
|
+
return @building.build_zone_hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# get the model
|
96
|
+
# @return [OpenStudio::Model]
|
97
|
+
def get_model
|
98
|
+
return @building.get_model
|
99
|
+
end
|
100
|
+
|
101
|
+
# get space types
|
102
|
+
# @return [array<OpenStudio::Model::SpaceType>]
|
103
|
+
def get_space_types
|
104
|
+
return @building.get_space_types
|
105
|
+
end
|
106
|
+
|
107
|
+
# get peak occupancy
|
108
|
+
# @return [hash<string, float>]
|
109
|
+
def get_peak_occupancy
|
110
|
+
return @building.get_peak_occupancy
|
111
|
+
end
|
112
|
+
|
113
|
+
# get floor area
|
114
|
+
# @return [hash<string, float>]
|
115
|
+
def get_floor_area
|
116
|
+
return @building.get_floor_area
|
117
|
+
end
|
118
|
+
|
119
|
+
# get building sections
|
120
|
+
# @return [array<BuildingSection>]
|
121
|
+
def get_building_sections
|
122
|
+
return @building.building_sections
|
123
|
+
end
|
124
|
+
|
125
|
+
# determine the open studio standard and call the set_all function
|
126
|
+
# @param standard_to_be_used [String]
|
127
|
+
# @return [Standard]
|
128
|
+
def determine_open_studio_standard(standard_to_be_used)
|
129
|
+
set_all
|
130
|
+
return @building.determine_open_studio_standard(standard_to_be_used)
|
131
|
+
end
|
132
|
+
|
133
|
+
# determine the open studio system standard and call the set_all function
|
134
|
+
# @return [Standard]
|
135
|
+
def determine_open_studio_system_standard
|
136
|
+
set_all
|
137
|
+
return Standard.build(get_standard_template)
|
138
|
+
end
|
139
|
+
|
140
|
+
# get @standard_template
|
141
|
+
# @return [String]
|
142
|
+
def get_standard_template
|
143
|
+
return @building.get_standard_template
|
144
|
+
end
|
145
|
+
|
146
|
+
# get space types from hash
|
147
|
+
# @param id [String]
|
148
|
+
# @return [hash<string, array<hash<string, string>>]
|
149
|
+
def get_space_types_from_hash(id)
|
150
|
+
return @building.build_space_type_hash[id]
|
151
|
+
end
|
152
|
+
|
153
|
+
# get system type
|
154
|
+
# @return [String]
|
155
|
+
def get_system_type
|
156
|
+
return @building.get_system_type
|
157
|
+
end
|
158
|
+
|
159
|
+
# get building type
|
160
|
+
# @return [String]
|
161
|
+
def get_building_type
|
162
|
+
if @standards_building_type.nil?
|
163
|
+
return @building.get_building_type
|
164
|
+
else
|
165
|
+
return @standards_building_type
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# get climate zone
|
170
|
+
# @return [String]
|
171
|
+
def get_climate_zone
|
172
|
+
if @climate_zone.nil?
|
173
|
+
return @building.get_climate_zone
|
174
|
+
else
|
175
|
+
return @climate_zone
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
# get building
|
180
|
+
# @return [Array<BuildingSync::Building>]
|
181
|
+
def get_building
|
182
|
+
return @building
|
183
|
+
end
|
184
|
+
|
185
|
+
# get full path to epw file
|
186
|
+
# @return [String]
|
187
|
+
def get_epw_file_path
|
188
|
+
return @building.get_epw_file_path
|
189
|
+
end
|
190
|
+
|
191
|
+
# generate baseline model in osm file format
|
192
|
+
# @param epw_file_path [String]
|
193
|
+
# @param standard_to_be_used [String]
|
194
|
+
# @param ddy_file [String]
|
195
|
+
def generate_baseline_osm(epw_file_path, standard_to_be_used, ddy_file = nil)
|
196
|
+
set_all
|
197
|
+
determine_climate_zone(standard_to_be_used)
|
198
|
+
|
199
|
+
# If we can't get the CZ from the site, we attempt to get from the building
|
200
|
+
@climate_zone = @building.get_climate_zone if @climate_zone.nil?
|
201
|
+
|
202
|
+
OpenStudio.logFree(OpenStudio::Warn, 'BuildingSync.Site.generate_baseline_osm', 'Could not find a climate zone in the BuildingSync file.') if @climate_zone.nil?
|
203
|
+
lat = @building.xget_text('Latitude').nil? ? xget_text('Latitude') : @building.xget_text('Latitude')
|
204
|
+
long = @building.xget_text('Longitude').nil? ? xget_text('Longitude') : @building.xget_text('Longitude')
|
205
|
+
weather_station_name = @building.xget_text('WeatherStationName').nil? ? xget_text('WeatherStationName') : @building.xget_text('WeatherStationName')
|
206
|
+
weather_station_id = @building.xget_text('WeatherDataStationID').nil? ? xget_text('WeatherDataStationID') : @building.xget_text('WeatherDataStationID')
|
207
|
+
@building.set_weather_and_climate_zone(@climate_zone, epw_file_path, standard_to_be_used, lat, long, ddy_file, weather_station_name, weather_station_id, @state_name, @city_name)
|
208
|
+
@building.generate_baseline_osm
|
209
|
+
end
|
210
|
+
|
211
|
+
# write model to osm file
|
212
|
+
# @param dir [String]
|
213
|
+
# @return [hash<string, string>]
|
214
|
+
def write_osm(dir)
|
215
|
+
@building.write_osm(dir)
|
216
|
+
scenario_types = {}
|
217
|
+
scenario_types['system_type'] = get_system_type
|
218
|
+
scenario_types['bldg_type'] = get_building_type
|
219
|
+
scenario_types['template'] = get_standard_template
|
220
|
+
return scenario_types
|
221
|
+
end
|
222
|
+
|
223
|
+
# write parameters to xml file
|
224
|
+
# @param site [Site]
|
225
|
+
# @param ns [String]
|
226
|
+
def prepare_final_xml
|
227
|
+
@base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:ASHRAE/#{@ns}:ClimateZone"].text = @climate_zone_ashrae if !@climate_zone_ashrae.nil?
|
228
|
+
@base_xml.elements["#{@ns}:ClimateZoneType/#{@ns}:CaliforniaTitle24/#{@ns}:ClimateZone"].text = @climate_zone_ca_t24 if !@climate_zone_ca_t24.nil?
|
229
|
+
|
230
|
+
@base_xml.elements["#{@ns}:Address/#{@ns}:City"].text = @city_name if !@city_name.nil?
|
231
|
+
@base_xml.elements["#{@ns}:Address/#{@ns}:State"].text = @state_name if !@state_name.nil?
|
232
|
+
|
233
|
+
# TODO: probably set these as UDFs from actual openstudio model
|
234
|
+
@base_xml.elements["#{@ns}:WeatherStationName"].text = @weather_file_name if !@weather_file_name.nil?
|
235
|
+
@base_xml.elements["#{@ns}:WeatherDataStationID"].text = @weather_station_id if !@weather_station_id.nil?
|
236
|
+
|
237
|
+
prepare_final_xml_for_spatial_element
|
238
|
+
|
239
|
+
@building.prepare_final_xml
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|