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