openstudio-load-flexibility-measures 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +36 -36
- data/.rubocop.yml +6 -9
- data/CHANGELOG.html +75 -75
- data/CHANGELOG.md +63 -48
- data/Gemfile +31 -7
- data/Jenkinsfile +11 -10
- data/LICENSE.md +27 -0
- data/README.md +57 -42
- data/Rakefile +15 -15
- data/doc_templates/LICENSE.md +26 -26
- data/doc_templates/README.md.erb +41 -41
- data/doc_templates/copyright_erb.txt +35 -35
- data/doc_templates/copyright_js.txt +3 -3
- data/doc_templates/copyright_ruby.txt +33 -33
- data/lib/measures/add_central_ice_storage/LICENSE.md +26 -26
- data/lib/measures/add_central_ice_storage/README.md +264 -264
- data/lib/measures/add_central_ice_storage/README.md.erb +41 -41
- data/lib/measures/add_central_ice_storage/measure.rb +1325 -1324
- data/lib/measures/add_central_ice_storage/measure.xml +503 -503
- data/lib/measures/add_central_ice_storage/resources/OsLib_Schedules.rb +171 -173
- data/lib/measures/add_central_ice_storage/tests/add_central_ice_storage_test.rb +203 -203
- data/lib/measures/add_central_ice_storage/tests/ice_test_model.osm +21523 -21523
- data/lib/measures/add_hpwh/LICENSE.md +26 -26
- data/lib/measures/add_hpwh/README.md +186 -186
- data/lib/measures/add_hpwh/README.md.erb +41 -41
- data/lib/measures/add_hpwh/docs/Flexible Domestic Hot Water Implementation Guide.pdf +0 -0
- data/lib/measures/add_hpwh/measure.rb +674 -647
- data/lib/measures/add_hpwh/measure.xml +402 -397
- data/lib/measures/add_hpwh/tests/SmallHotel-2A.osm +42893 -42893
- data/lib/measures/add_hpwh/tests/add_hpwh_test.rb +237 -0
- data/lib/measures/add_packaged_ice_storage/LICENSE.md +26 -26
- data/lib/measures/add_packaged_ice_storage/README.html +185 -185
- data/lib/measures/add_packaged_ice_storage/README.md +189 -189
- data/lib/measures/add_packaged_ice_storage/measure.rb +694 -691
- data/lib/measures/add_packaged_ice_storage/measure.xml +245 -245
- data/lib/measures/add_packaged_ice_storage/resources/TESCurves.idf +1059 -1059
- data/lib/measures/add_packaged_ice_storage/tests/MeasureTest.osm +9507 -9507
- data/lib/measures/add_packaged_ice_storage/tests/add_packaged_ice_storage_test.rb +96 -96
- data/lib/openstudio/load_flexibility_measures/version.rb +40 -40
- data/lib/openstudio/load_flexibility_measures.rb +50 -50
- data/openstudio-load-flexibility-measures.gemspec +33 -34
- metadata +25 -24
- data/lib/measures/add_hpwh/tests/add_hphw_test.rb +0 -98
@@ -0,0 +1,237 @@
|
|
1
|
+
# *******************************************************************************
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2021, 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
|
+
# insert your copyright here
|
37
|
+
|
38
|
+
require 'openstudio'
|
39
|
+
require 'openstudio/measure/ShowRunnerOutput'
|
40
|
+
require 'minitest/autorun'
|
41
|
+
require_relative '../measure'
|
42
|
+
require 'fileutils'
|
43
|
+
|
44
|
+
class AddHpwhTest < Minitest::Test
|
45
|
+
# def setup
|
46
|
+
# end
|
47
|
+
|
48
|
+
# def teardown
|
49
|
+
# end
|
50
|
+
|
51
|
+
def test_good_argument_values
|
52
|
+
# create an instance of the measure
|
53
|
+
measure = AddHpwh.new
|
54
|
+
|
55
|
+
# create runner with empty OSW
|
56
|
+
osw = OpenStudio::WorkflowJSON.new
|
57
|
+
runner = OpenStudio::Measure::OSRunner.new(osw)
|
58
|
+
|
59
|
+
# load the test model
|
60
|
+
translator = OpenStudio::OSVersion::VersionTranslator.new
|
61
|
+
path = "#{File.dirname(__FILE__)}/SmallHotel-2A.osm"
|
62
|
+
model = translator.loadModel(path)
|
63
|
+
assert(!model.empty?)
|
64
|
+
model = model.get
|
65
|
+
|
66
|
+
# get arguments
|
67
|
+
arguments = measure.arguments(model)
|
68
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
69
|
+
|
70
|
+
# create hash of argument values.
|
71
|
+
# If the argument has a default that you want to use, you don't need it in the hash
|
72
|
+
args_hash = {}
|
73
|
+
# using defaults values from measure.rb for other arguments
|
74
|
+
|
75
|
+
# populate argument with specified hash value if specified
|
76
|
+
arguments.each do |arg|
|
77
|
+
temp_arg_var = arg.clone
|
78
|
+
if args_hash.key?(arg.name)
|
79
|
+
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
80
|
+
end
|
81
|
+
argument_map[arg.name] = temp_arg_var
|
82
|
+
end
|
83
|
+
|
84
|
+
# run the measure
|
85
|
+
measure.run(model, runner, argument_map)
|
86
|
+
result = runner.result
|
87
|
+
|
88
|
+
# show the output
|
89
|
+
show_output(result)
|
90
|
+
|
91
|
+
# assert that it ran correctly
|
92
|
+
assert_equal('Success', result.value.valueName)
|
93
|
+
|
94
|
+
# save the model to test output directory
|
95
|
+
output_file_path = "#{File.dirname(__FILE__)}//output/test_output.osm"
|
96
|
+
model.save(output_file_path, true)
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_empty_model
|
100
|
+
# create an instance of the measure
|
101
|
+
measure = AddHpwh.new
|
102
|
+
|
103
|
+
# create runner with empty OSW
|
104
|
+
osw = OpenStudio::WorkflowJSON.new
|
105
|
+
runner = OpenStudio::Measure::OSRunner.new(osw)
|
106
|
+
|
107
|
+
# make an empty model
|
108
|
+
model = OpenStudio::Model::Model.new
|
109
|
+
|
110
|
+
# get arguments
|
111
|
+
arguments = measure.arguments(model)
|
112
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
113
|
+
|
114
|
+
# create hash of argument values
|
115
|
+
args_hash = {}
|
116
|
+
|
117
|
+
# populate argument with specified hash value if specified
|
118
|
+
arguments.each do |arg|
|
119
|
+
temp_arg_var = arg.clone
|
120
|
+
if args_hash.key?(arg.name)
|
121
|
+
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
122
|
+
end
|
123
|
+
argument_map[arg.name] = temp_arg_var
|
124
|
+
end
|
125
|
+
|
126
|
+
# run the measure
|
127
|
+
measure.run(model, runner, argument_map)
|
128
|
+
result = runner.result
|
129
|
+
|
130
|
+
# show the output
|
131
|
+
show_output(result)
|
132
|
+
|
133
|
+
# assert that it failed
|
134
|
+
assert_equal('Fail', result.value.valueName)
|
135
|
+
assert(result.errors.size == 1)
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_custom_args_PumpedCondenser_specific_zone
|
139
|
+
# create an instance of the measure
|
140
|
+
measure = AddHpwh.new
|
141
|
+
|
142
|
+
# create runner with empty OSW
|
143
|
+
osw = OpenStudio::WorkflowJSON.new
|
144
|
+
runner = OpenStudio::Measure::OSRunner.new(osw)
|
145
|
+
|
146
|
+
# load the test model
|
147
|
+
translator = OpenStudio::OSVersion::VersionTranslator.new
|
148
|
+
path = "#{File.dirname(__FILE__)}/SmallHotel-2A.osm"
|
149
|
+
model = translator.loadModel(path)
|
150
|
+
assert(!model.empty?)
|
151
|
+
model = model.get
|
152
|
+
|
153
|
+
# get arguments
|
154
|
+
arguments = measure.arguments(model)
|
155
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
156
|
+
|
157
|
+
# create hash of argument values.
|
158
|
+
# If the argument has a default that you want to use, you don't need it in the hash
|
159
|
+
args_hash = {}
|
160
|
+
args_hash['zone'] = 'FrontOfficeFlr1 ZN'
|
161
|
+
args_hash['type'] = 'PumpedCondenser'
|
162
|
+
# using defaults values from measure.rb for other arguments
|
163
|
+
|
164
|
+
# populate argument with specified hash value if specified
|
165
|
+
arguments.each do |arg|
|
166
|
+
temp_arg_var = arg.clone
|
167
|
+
if args_hash.key?(arg.name)
|
168
|
+
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
169
|
+
end
|
170
|
+
argument_map[arg.name] = temp_arg_var
|
171
|
+
end
|
172
|
+
|
173
|
+
# run the measure
|
174
|
+
measure.run(model, runner, argument_map)
|
175
|
+
result = runner.result
|
176
|
+
|
177
|
+
# show the output
|
178
|
+
show_output(result)
|
179
|
+
|
180
|
+
# assert that it ran correctly
|
181
|
+
assert_equal('Success', result.value.valueName)
|
182
|
+
|
183
|
+
# save the model to test output directory
|
184
|
+
output_file_path = "#{File.dirname(__FILE__)}//output/test_output.osm"
|
185
|
+
model.save(output_file_path, true)
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_custom_args_WrappedCondenser_specific_zone
|
189
|
+
# create an instance of the measure
|
190
|
+
measure = AddHpwh.new
|
191
|
+
|
192
|
+
# create runner with empty OSW
|
193
|
+
osw = OpenStudio::WorkflowJSON.new
|
194
|
+
runner = OpenStudio::Measure::OSRunner.new(osw)
|
195
|
+
|
196
|
+
# load the test model
|
197
|
+
translator = OpenStudio::OSVersion::VersionTranslator.new
|
198
|
+
path = "#{File.dirname(__FILE__)}/SmallHotel-2A.osm"
|
199
|
+
model = translator.loadModel(path)
|
200
|
+
assert(!model.empty?)
|
201
|
+
model = model.get
|
202
|
+
|
203
|
+
# get arguments
|
204
|
+
arguments = measure.arguments(model)
|
205
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
206
|
+
|
207
|
+
# create hash of argument values.
|
208
|
+
# If the argument has a default that you want to use, you don't need it in the hash
|
209
|
+
args_hash = {}
|
210
|
+
args_hash['zone'] = 'FrontOfficeFlr1 ZN'
|
211
|
+
args_hash['type'] = 'WrappedCondenser'
|
212
|
+
# using defaults values from measure.rb for other arguments
|
213
|
+
|
214
|
+
# populate argument with specified hash value if specified
|
215
|
+
arguments.each do |arg|
|
216
|
+
temp_arg_var = arg.clone
|
217
|
+
if args_hash.key?(arg.name)
|
218
|
+
assert(temp_arg_var.setValue(args_hash[arg.name]))
|
219
|
+
end
|
220
|
+
argument_map[arg.name] = temp_arg_var
|
221
|
+
end
|
222
|
+
|
223
|
+
# run the measure
|
224
|
+
measure.run(model, runner, argument_map)
|
225
|
+
result = runner.result
|
226
|
+
|
227
|
+
# show the output
|
228
|
+
show_output(result)
|
229
|
+
|
230
|
+
# assert that it ran correctly
|
231
|
+
assert_equal('Success', result.value.valueName)
|
232
|
+
|
233
|
+
# save the model to test output directory
|
234
|
+
output_file_path = "#{File.dirname(__FILE__)}//output/test_output.osm"
|
235
|
+
model.save(output_file_path, true)
|
236
|
+
end
|
237
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. All rights reserved.
|
2
|
-
|
3
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted
|
4
|
-
provided that the following conditions are met:
|
5
|
-
|
6
|
-
(1) Redistributions of source code must retain the above copyright notice, this list of conditions
|
7
|
-
and the following disclaimer.
|
8
|
-
|
9
|
-
(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
10
|
-
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
11
|
-
|
12
|
-
(3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
|
13
|
-
or promote products derived from this software without specific prior written permission from the
|
14
|
-
respective party.
|
15
|
-
|
16
|
-
(4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
|
17
|
-
derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
|
18
|
-
designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
|
19
|
-
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
21
|
-
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
22
|
-
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
|
23
|
-
OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
25
|
-
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
26
|
-
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
1
|
+
OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
4
|
+
provided that the following conditions are met:
|
5
|
+
|
6
|
+
(1) Redistributions of source code must retain the above copyright notice, this list of conditions
|
7
|
+
and the following disclaimer.
|
8
|
+
|
9
|
+
(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
10
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
(3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
|
13
|
+
or promote products derived from this software without specific prior written permission from the
|
14
|
+
respective party.
|
15
|
+
|
16
|
+
(4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
|
17
|
+
derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
|
18
|
+
designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
21
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
22
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
|
23
|
+
OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
25
|
+
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
26
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
27
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|