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.
- checksums.yaml +4 -4
- data/.gitignore +36 -36
- data/.rubocop.yml +6 -9
- data/CHANGELOG.html +75 -75
- data/CHANGELOG.md +59 -37
- data/Gemfile +31 -7
- data/Jenkinsfile +11 -0
- data/README.md +53 -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 +663 -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_hphw_test.rb → add_hpwh_test.rb} +137 -98
- 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 -32
- metadata +27 -27
@@ -1,173 +1,171 @@
|
|
1
|
-
# *******************************************************************************
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
'
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
sch_ruleset
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
sch_ruleset.
|
106
|
-
winter_dsn_day
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
sch_ruleset.
|
119
|
-
summer_dsn_day
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
default_day
|
130
|
-
|
131
|
-
default_data_array
|
132
|
-
default_data_array.
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
rule
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
rule.
|
148
|
-
|
149
|
-
|
150
|
-
rule.
|
151
|
-
rule.
|
152
|
-
rule.
|
153
|
-
rule.
|
154
|
-
rule.
|
155
|
-
rule.
|
156
|
-
|
157
|
-
day_schedule
|
158
|
-
|
159
|
-
data_array.delete_at(0)
|
160
|
-
data_array.delete_at(0)
|
161
|
-
data_array.
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
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
|