openstudio-load-flexibility-measures 0.2.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
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,173 +1,171 @@
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
- module OsLib_Schedules
37
- # create a ruleset schedule with a basic profile
38
- def self.createSimpleSchedule(model, options = {})
39
- defaults = {
40
- 'name' => nil,
41
- 'winterTimeValuePairs' => { 24.0 => 0.0 },
42
- 'summerTimeValuePairs' => { 24.0 => 1.0 },
43
- 'defaultTimeValuePairs' => { 24.0 => 1.0 }
44
- }
45
-
46
- # merge user inputs with defaults
47
- options = defaults.merge(options)
48
-
49
- # ScheduleRuleset
50
- sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
51
- sch_ruleset.setName(options['name']) if name
52
-
53
- # Winter Design Day
54
- winter_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
55
- sch_ruleset.setWinterDesignDaySchedule(winter_dsn_day)
56
- winter_dsn_day = sch_ruleset.winterDesignDaySchedule
57
- winter_dsn_day.setName("#{sch_ruleset.name} Winter Design Day")
58
- options['winterTimeValuePairs'].each do |k, v|
59
- hour = k.truncate
60
- min = ((k - hour) * 60).to_i
61
- winter_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
62
- end
63
-
64
- # Summer Design Day
65
- summer_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
66
- sch_ruleset.setSummerDesignDaySchedule(summer_dsn_day)
67
- summer_dsn_day = sch_ruleset.summerDesignDaySchedule
68
- summer_dsn_day.setName("#{sch_ruleset.name} Summer Design Day")
69
- options['summerTimeValuePairs'].each do |k, v|
70
- hour = k.truncate
71
- min = ((k - hour) * 60).to_i
72
- summer_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
73
- end
74
-
75
- # All Days
76
- week_day = sch_ruleset.defaultDaySchedule
77
- week_day.setName("#{sch_ruleset.name} Schedule Week Day")
78
- options['defaultTimeValuePairs'].each do |k, v|
79
- hour = k.truncate
80
- min = ((k - hour) * 60).to_i
81
- week_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
82
- end
83
-
84
- result = sch_ruleset
85
- result
86
- end # end of OsLib_Schedules.createSimpleSchedule
87
-
88
- # create a complex ruleset schedule
89
- def self.createComplexSchedule(model, options = {})
90
- defaults = {
91
- 'name' => nil,
92
- 'default_day' => ['always_on', [24.0, 1.0]]
93
- }
94
-
95
- # merge user inputs with defaults
96
- options = defaults.merge(options)
97
-
98
- # ScheduleRuleset
99
- sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
100
- sch_ruleset.setName(options['name']) if name
101
-
102
- # Winter Design Day
103
- unless options['winter_design_day'].nil?
104
- winter_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
105
- sch_ruleset.setWinterDesignDaySchedule(winter_dsn_day)
106
- winter_dsn_day = sch_ruleset.winterDesignDaySchedule
107
- winter_dsn_day.setName("#{sch_ruleset.name} Winter Design Day")
108
- options['winter_design_day'].each do |data_pair|
109
- hour = data_pair[0].truncate
110
- min = ((data_pair[0] - hour) * 60).to_i
111
- winter_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
112
- end
113
- end
114
-
115
- # Summer Design Day
116
- unless options['summer_design_day'].nil?
117
- summer_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
118
- sch_ruleset.setSummerDesignDaySchedule(summer_dsn_day)
119
- summer_dsn_day = sch_ruleset.summerDesignDaySchedule
120
- summer_dsn_day.setName("#{sch_ruleset.name} Summer Design Day")
121
- options['summer_design_day'].each do |data_pair|
122
- hour = data_pair[0].truncate
123
- min = ((data_pair[0] - hour) * 60).to_i
124
- summer_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
125
- end
126
- end
127
-
128
- # Default Day
129
- default_day = sch_ruleset.defaultDaySchedule
130
- default_day.setName("#{sch_ruleset.name} #{options['default_day'][0]}")
131
- default_data_array = options['default_day']
132
- default_data_array.delete_at(0)
133
- default_data_array.each do |data_pair|
134
- hour = data_pair[0].truncate
135
- min = ((data_pair[0] - hour) * 60).to_i
136
- default_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
137
- end
138
-
139
- # Rules
140
- unless options['rules'].nil?
141
- options['rules'].each do |data_array|
142
- rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
143
- rule.setName("#{sch_ruleset.name} #{data_array[0]} Rule")
144
- date_range = data_array[1].split('-')
145
- start_date = date_range[0].split('/')
146
- end_date = date_range[1].split('/')
147
- rule.setStartDate(model.getYearDescription.makeDate(start_date[0].to_i, start_date[1].to_i))
148
- rule.setEndDate(model.getYearDescription.makeDate(end_date[0].to_i, end_date[1].to_i))
149
- days = data_array[2].split('/')
150
- rule.setApplySunday(true) if days.include? 'Sun'
151
- rule.setApplyMonday(true) if days.include? 'Mon'
152
- rule.setApplyTuesday(true) if days.include? 'Tue'
153
- rule.setApplyWednesday(true) if days.include? 'Wed'
154
- rule.setApplyThursday(true) if days.include? 'Thu'
155
- rule.setApplyFriday(true) if days.include? 'Fri'
156
- rule.setApplySaturday(true) if days.include? 'Sat'
157
- day_schedule = rule.daySchedule
158
- day_schedule.setName("#{sch_ruleset.name} #{data_array[0]}")
159
- data_array.delete_at(0)
160
- data_array.delete_at(0)
161
- data_array.delete_at(0)
162
- data_array.each do |data_pair|
163
- hour = data_pair[0].truncate
164
- min = ((data_pair[0] - hour) * 60).to_i
165
- day_schedule.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
166
- end
167
- end
168
- end
169
-
170
- result = sch_ruleset
171
- result
172
- end # end of OsLib_Schedules.createComplexSchedule
173
- 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
+ module OsLib_Schedules
37
+ # create a ruleset schedule with a basic profile
38
+ def self.createSimpleSchedule(model, options = {})
39
+ defaults = {
40
+ 'name' => nil,
41
+ 'winterTimeValuePairs' => { 24.0 => 0.0 },
42
+ 'summerTimeValuePairs' => { 24.0 => 1.0 },
43
+ 'defaultTimeValuePairs' => { 24.0 => 1.0 }
44
+ }
45
+
46
+ # merge user inputs with defaults
47
+ options = defaults.merge(options)
48
+
49
+ # ScheduleRuleset
50
+ sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
51
+ sch_ruleset.setName(options['name']) if name
52
+
53
+ # Winter Design Day
54
+ winter_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
55
+ sch_ruleset.setWinterDesignDaySchedule(winter_dsn_day)
56
+ winter_dsn_day = sch_ruleset.winterDesignDaySchedule
57
+ winter_dsn_day.setName("#{sch_ruleset.name} Winter Design Day")
58
+ options['winterTimeValuePairs'].each do |k, v|
59
+ hour = k.truncate
60
+ min = ((k - hour) * 60).to_i
61
+ winter_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
62
+ end
63
+
64
+ # Summer Design Day
65
+ summer_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
66
+ sch_ruleset.setSummerDesignDaySchedule(summer_dsn_day)
67
+ summer_dsn_day = sch_ruleset.summerDesignDaySchedule
68
+ summer_dsn_day.setName("#{sch_ruleset.name} Summer Design Day")
69
+ options['summerTimeValuePairs'].each do |k, v|
70
+ hour = k.truncate
71
+ min = ((k - hour) * 60).to_i
72
+ summer_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
73
+ end
74
+
75
+ # All Days
76
+ week_day = sch_ruleset.defaultDaySchedule
77
+ week_day.setName("#{sch_ruleset.name} Schedule Week Day")
78
+ options['defaultTimeValuePairs'].each do |k, v|
79
+ hour = k.truncate
80
+ min = ((k - hour) * 60).to_i
81
+ week_day.addValue(OpenStudio::Time.new(0, hour, min, 0), v)
82
+ end
83
+
84
+ sch_ruleset
85
+ end
86
+
87
+ # create a complex ruleset schedule
88
+ def self.createComplexSchedule(model, options = {})
89
+ defaults = {
90
+ 'name' => nil,
91
+ 'default_day' => ['always_on', [24.0, 1.0]]
92
+ }
93
+
94
+ # merge user inputs with defaults
95
+ options = defaults.merge(options)
96
+
97
+ # ScheduleRuleset
98
+ sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
99
+ sch_ruleset.setName(options['name']) if name
100
+
101
+ # Winter Design Day
102
+ unless options['winter_design_day'].nil?
103
+ winter_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
104
+ sch_ruleset.setWinterDesignDaySchedule(winter_dsn_day)
105
+ winter_dsn_day = sch_ruleset.winterDesignDaySchedule
106
+ winter_dsn_day.setName("#{sch_ruleset.name} Winter Design Day")
107
+ options['winter_design_day'].each do |data_pair|
108
+ hour = data_pair[0].truncate
109
+ min = ((data_pair[0] - hour) * 60).to_i
110
+ winter_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
111
+ end
112
+ end
113
+
114
+ # Summer Design Day
115
+ unless options['summer_design_day'].nil?
116
+ summer_dsn_day = OpenStudio::Model::ScheduleDay.new(model)
117
+ sch_ruleset.setSummerDesignDaySchedule(summer_dsn_day)
118
+ summer_dsn_day = sch_ruleset.summerDesignDaySchedule
119
+ summer_dsn_day.setName("#{sch_ruleset.name} Summer Design Day")
120
+ options['summer_design_day'].each do |data_pair|
121
+ hour = data_pair[0].truncate
122
+ min = ((data_pair[0] - hour) * 60).to_i
123
+ summer_dsn_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
124
+ end
125
+ end
126
+
127
+ # Default Day
128
+ default_day = sch_ruleset.defaultDaySchedule
129
+ default_day.setName("#{sch_ruleset.name} #{options['default_day'][0]}")
130
+ default_data_array = options['default_day']
131
+ default_data_array.delete_at(0)
132
+ default_data_array.each do |data_pair|
133
+ hour = data_pair[0].truncate
134
+ min = ((data_pair[0] - hour) * 60).to_i
135
+ default_day.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
136
+ end
137
+
138
+ # Rules
139
+ unless options['rules'].nil?
140
+ options['rules'].each do |data_array|
141
+ rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
142
+ rule.setName("#{sch_ruleset.name} #{data_array[0]} Rule")
143
+ date_range = data_array[1].split('-')
144
+ start_date = date_range[0].split('/')
145
+ end_date = date_range[1].split('/')
146
+ rule.setStartDate(model.getYearDescription.makeDate(start_date[0].to_i, start_date[1].to_i))
147
+ rule.setEndDate(model.getYearDescription.makeDate(end_date[0].to_i, end_date[1].to_i))
148
+ days = data_array[2].split('/')
149
+ rule.setApplySunday(true) if days.include? 'Sun'
150
+ rule.setApplyMonday(true) if days.include? 'Mon'
151
+ rule.setApplyTuesday(true) if days.include? 'Tue'
152
+ rule.setApplyWednesday(true) if days.include? 'Wed'
153
+ rule.setApplyThursday(true) if days.include? 'Thu'
154
+ rule.setApplyFriday(true) if days.include? 'Fri'
155
+ rule.setApplySaturday(true) if days.include? 'Sat'
156
+ day_schedule = rule.daySchedule
157
+ day_schedule.setName("#{sch_ruleset.name} #{data_array[0]}")
158
+ data_array.delete_at(0)
159
+ data_array.delete_at(0)
160
+ data_array.delete_at(0)
161
+ data_array.each do |data_pair|
162
+ hour = data_pair[0].truncate
163
+ min = ((data_pair[0] - hour) * 60).to_i
164
+ day_schedule.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
165
+ end
166
+ end
167
+ end
168
+
169
+ sch_ruleset
170
+ end
171
+ end