openstudio-load-flexibility-measures 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) 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 -54
  6. data/Gemfile +31 -7
  7. data/Jenkinsfile +11 -10
  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 -26
  25. data/lib/measures/add_hpwh/README.md.erb +41 -41
  26. data/lib/measures/add_hpwh/measure.rb +663 -645
  27. data/lib/measures/add_hpwh/measure.xml +402 -463
  28. data/lib/measures/add_hpwh/tests/SmallHotel-2A.osm +42893 -42893
  29. data/lib/measures/add_hpwh/tests/{add_hphw_test.rb → add_hpwh_test.rb} +137 -98
  30. data/lib/measures/add_packaged_ice_storage/LICENSE.md +26 -26
  31. data/lib/measures/add_packaged_ice_storage/README.html +185 -185
  32. data/lib/measures/add_packaged_ice_storage/README.md +189 -189
  33. data/lib/measures/add_packaged_ice_storage/measure.rb +694 -691
  34. data/lib/measures/add_packaged_ice_storage/measure.xml +245 -245
  35. data/lib/measures/add_packaged_ice_storage/resources/TESCurves.idf +1059 -1059
  36. data/lib/measures/add_packaged_ice_storage/tests/MeasureTest.osm +9507 -9507
  37. data/lib/measures/add_packaged_ice_storage/tests/add_packaged_ice_storage_test.rb +96 -96
  38. data/lib/openstudio/load_flexibility_measures/version.rb +40 -40
  39. data/lib/openstudio/load_flexibility_measures.rb +50 -50
  40. data/openstudio-load-flexibility-measures.gemspec +33 -34
  41. metadata +26 -26
@@ -1,98 +1,137 @@
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 AddHphwTest < 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 = AddHphw.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
- # assert that it ran correctly
89
- assert_equal('Success', result.value.valueName)
90
-
91
- # show the output
92
- show_output(result)
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
- 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 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
+ # assert that it ran correctly
89
+ assert_equal('Success', result.value.valueName)
90
+
91
+ # show the output
92
+ show_output(result)
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
+ 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.