urbanopt-scenario 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/CONTRIBUTING.md +58 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/pull_request_template.md +23 -0
- data/.gitignore +26 -0
- data/.rdoc_options +36 -0
- data/.rspec +3 -0
- data/.rubocop.yml +10 -0
- data/.travis.yml +23 -0
- data/CHANGELOG.md +19 -0
- data/Gemfile +43 -0
- data/Jenkinsfile +10 -0
- data/LICENSE.md +27 -0
- data/RDOC_MAIN.md +39 -0
- data/README.md +39 -0
- data/Rakefile +51 -0
- data/deploy_docs.sh +5 -0
- data/doc_templates/LICENSE.md +27 -0
- data/doc_templates/README.md.erb +42 -0
- data/doc_templates/copyright_erb.txt +31 -0
- data/doc_templates/copyright_js.txt +4 -0
- data/doc_templates/copyright_ruby.txt +29 -0
- data/docs/.gitignore +3 -0
- data/docs/.vuepress/components/InnerJsonSchema.vue +84 -0
- data/docs/.vuepress/components/JsonSchema.vue +12 -0
- data/docs/.vuepress/components/ScenarioSchema.vue +12 -0
- data/docs/.vuepress/components/StaticLink.vue +8 -0
- data/docs/.vuepress/config.js +15 -0
- data/docs/.vuepress/highlight.js +8 -0
- data/docs/.vuepress/public/custom_rdoc_styles.css +74 -0
- data/docs/.vuepress/utils.js +17 -0
- data/docs/README.md +39 -0
- data/docs/package-lock.json +11817 -0
- data/docs/package.json +26 -0
- data/docs/schemas/scenario-schema.md +3 -0
- data/lib/change_log.rb +147 -0
- data/lib/measures/.rubocop.yml +5 -0
- data/lib/measures/default_feature_reports/LICENSE.md +27 -0
- data/lib/measures/default_feature_reports/README.md +56 -0
- data/lib/measures/default_feature_reports/README.md.erb +42 -0
- data/lib/measures/default_feature_reports/measure.rb +742 -0
- data/lib/measures/default_feature_reports/measure.xml +139 -0
- data/lib/measures/default_feature_reports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
- data/lib/measures/default_feature_reports/tests/default_feature_reports_test.rb +238 -0
- data/lib/measures/default_feature_reports/tests/example_model.osm +4378 -0
- data/lib/urbanopt-scenario.rb +31 -0
- data/lib/urbanopt/scenario.rb +45 -0
- data/lib/urbanopt/scenario/default_reports.rb +40 -0
- data/lib/urbanopt/scenario/default_reports/construction_cost.rb +169 -0
- data/lib/urbanopt/scenario/default_reports/date.rb +97 -0
- data/lib/urbanopt/scenario/default_reports/distributed_generation.rb +187 -0
- data/lib/urbanopt/scenario/default_reports/end_use.rb +159 -0
- data/lib/urbanopt/scenario/default_reports/end_uses.rb +140 -0
- data/lib/urbanopt/scenario/default_reports/feature_report.rb +213 -0
- data/lib/urbanopt/scenario/default_reports/generator.rb +92 -0
- data/lib/urbanopt/scenario/default_reports/location.rb +99 -0
- data/lib/urbanopt/scenario/default_reports/logger.rb +44 -0
- data/lib/urbanopt/scenario/default_reports/program.rb +261 -0
- data/lib/urbanopt/scenario/default_reports/reporting_period.rb +298 -0
- data/lib/urbanopt/scenario/default_reports/scenario_report.rb +300 -0
- data/lib/urbanopt/scenario/default_reports/schema/README.md +34 -0
- data/lib/urbanopt/scenario/default_reports/schema/scenario_csv_columns.txt +13 -0
- data/lib/urbanopt/scenario/default_reports/schema/scenario_schema.json +830 -0
- data/lib/urbanopt/scenario/default_reports/solar_pv.rb +92 -0
- data/lib/urbanopt/scenario/default_reports/storage.rb +105 -0
- data/lib/urbanopt/scenario/default_reports/timeseries_csv.rb +258 -0
- data/lib/urbanopt/scenario/default_reports/validator.rb +97 -0
- data/lib/urbanopt/scenario/default_reports/wind.rb +92 -0
- data/lib/urbanopt/scenario/extension.rb +63 -0
- data/lib/urbanopt/scenario/logger.rb +42 -0
- data/lib/urbanopt/scenario/scenario_base.rb +79 -0
- data/lib/urbanopt/scenario/scenario_csv.rb +122 -0
- data/lib/urbanopt/scenario/scenario_datapoint_base.rb +162 -0
- data/lib/urbanopt/scenario/scenario_post_processor_base.rb +69 -0
- data/lib/urbanopt/scenario/scenario_post_processor_default.rb +98 -0
- data/lib/urbanopt/scenario/scenario_runner_base.rb +63 -0
- data/lib/urbanopt/scenario/scenario_runner_osw.rb +158 -0
- data/lib/urbanopt/scenario/simulation_dir_base.rb +90 -0
- data/lib/urbanopt/scenario/simulation_dir_osw.rb +261 -0
- data/lib/urbanopt/scenario/simulation_mapper_base.rb +47 -0
- data/lib/urbanopt/scenario/version.rb +35 -0
- data/urbanopt-scenario-gem.gemspec +38 -0
- metadata +251 -0
@@ -0,0 +1,90 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
+
# contributors. All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
# are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
+
# of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
+
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
+
# materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
+
# used to endorse or promote products derived from this software without specific
|
17
|
+
# prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# *********************************************************************************
|
30
|
+
|
31
|
+
module URBANopt
|
32
|
+
module Scenario
|
33
|
+
class SimulationDirBase
|
34
|
+
##
|
35
|
+
# SimulationDirBase is the agnostic representation of a directory of simulation input files.
|
36
|
+
##
|
37
|
+
# [parameters:]
|
38
|
+
# +scenario+ - _ScenarioBase_ - Scenario containing this SimulationDirBase.
|
39
|
+
# +features+ - _Array_ - Array of Features that this SimulationDirBase represents.
|
40
|
+
# +feature_names+ - _Array_ - Array of scenario specific names for these Features.
|
41
|
+
def initialize(scenario, features, feature_names)
|
42
|
+
@scenario = scenario
|
43
|
+
@features = features
|
44
|
+
@feature_names = feature_names
|
45
|
+
end
|
46
|
+
|
47
|
+
attr_reader :scenario #:nodoc:
|
48
|
+
|
49
|
+
attr_reader :features #:nodoc:
|
50
|
+
|
51
|
+
attr_reader :feature_names #:nodoc:
|
52
|
+
|
53
|
+
##
|
54
|
+
# Return the directory that this simulation will run in
|
55
|
+
##
|
56
|
+
def run_dir
|
57
|
+
raise 'run_dir is not implemented for SimulationFileBase, override in your class'
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Return true if the simulation is out of date (input files newer than results), false otherwise.
|
62
|
+
# Non-existant simulation input files are out of date.
|
63
|
+
##
|
64
|
+
def out_of_date?
|
65
|
+
raise 'out_of_date? is not implemented for SimulationFileBase, override in your class'
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Returns simulation status one of {'Not Started', 'Started', 'Complete', 'Failed'}
|
70
|
+
##
|
71
|
+
def simulation_status
|
72
|
+
raise 'simulation_status is not implemented for SimulationFileBase, override in your class'
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Clear the directory that this simulation runs in
|
77
|
+
##
|
78
|
+
def clear
|
79
|
+
raise 'clear is not implemented for SimulationFileBase, override in your class'
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Create run directory and generate simulation inputs, all previous contents of directory are removed
|
84
|
+
##
|
85
|
+
def create_input_files
|
86
|
+
raise 'create_input_files is not implemented for SimulationFileBase, override in your class'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,261 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
+
# contributors. All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
# are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
+
# of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
+
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
+
# materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
+
# used to endorse or promote products derived from this software without specific
|
17
|
+
# prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# *********************************************************************************
|
30
|
+
|
31
|
+
require 'urbanopt/scenario/simulation_dir_base'
|
32
|
+
|
33
|
+
module URBANopt
|
34
|
+
module Scenario
|
35
|
+
class SimulationDirOSW < SimulationDirBase
|
36
|
+
##
|
37
|
+
# SimulationDirOSW creates a OSW file to simulate features, a SimulationMapperBase is invoked to translate features to OSW.
|
38
|
+
##
|
39
|
+
# [parameters:]
|
40
|
+
# +scenario+ - _ScenarioBase_ - Scenario containing this SimulationFileBase.
|
41
|
+
# +features+ - _Array_ - Array of Features this SimulationFile represents.
|
42
|
+
# +feature_names+ - _Array_ - Array of scenario specific names for these Features.
|
43
|
+
# +mapper_class+ - _String_ - Name of class derived frmo SimulationMapperBase used to translate feature to simulation OSW.
|
44
|
+
def initialize(scenario, features, feature_names, mapper_class)
|
45
|
+
super(scenario, features, feature_names)
|
46
|
+
|
47
|
+
if features.size != 1
|
48
|
+
raise 'SimulationDirOSW currently cannot simulate more than one feature'
|
49
|
+
end
|
50
|
+
|
51
|
+
@feature = features[0]
|
52
|
+
@feature_id = @feature.id
|
53
|
+
|
54
|
+
if feature_names.size == 1
|
55
|
+
@feature_name = feature_names[0]
|
56
|
+
else
|
57
|
+
@feature_name = @feature.name
|
58
|
+
end
|
59
|
+
|
60
|
+
@mapper_class = mapper_class
|
61
|
+
end
|
62
|
+
|
63
|
+
attr_reader :mapper_class
|
64
|
+
|
65
|
+
##
|
66
|
+
# Return the directory that this simulation will run in.
|
67
|
+
##
|
68
|
+
def run_dir
|
69
|
+
raise 'Feature ID not set' if @feature_id.nil?
|
70
|
+
raise 'Scenario run dir not set' if scenario.run_dir.nil?
|
71
|
+
return File.join(scenario.run_dir, @feature_id + '/')
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Return the input OSW path
|
76
|
+
##
|
77
|
+
def in_osw_path
|
78
|
+
return File.join(run_dir, 'in.osw')
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Return the input OSW
|
83
|
+
##
|
84
|
+
def in_osw
|
85
|
+
result = nil
|
86
|
+
if File.exist?(in_osw_path)
|
87
|
+
File.open(in_osw_path, 'r') do |f|
|
88
|
+
result = JSON.parse(f.read, symbolize_names: true)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
return result
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Return the started.job path
|
96
|
+
##
|
97
|
+
def started_job_path
|
98
|
+
return File.join(run_dir, 'started.job')
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Return the failed.job path
|
103
|
+
##
|
104
|
+
def failed_job_path
|
105
|
+
return File.join(run_dir, 'failed.job')
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Return the finished.job path
|
110
|
+
##
|
111
|
+
def finished_job_path
|
112
|
+
return File.join(run_dir, 'finished.job')
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Return the output OSW path
|
117
|
+
##
|
118
|
+
def out_osw_path
|
119
|
+
return File.join(run_dir, 'out.osw')
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Return the output OSW
|
124
|
+
##
|
125
|
+
def out_osw
|
126
|
+
result = nil
|
127
|
+
if File.exist?(out_osw_path)
|
128
|
+
File.open(out_osw_path, 'r') do |f|
|
129
|
+
result = JSON.parse(f.read, symbolize_names: true)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
return result
|
133
|
+
end
|
134
|
+
|
135
|
+
# rubocop: disable Metrics/AbcSize #:nodoc:
|
136
|
+
|
137
|
+
##
|
138
|
+
# Return true if the simulation is out of date (input files newer than results), false otherwise.
|
139
|
+
# Non-existant simulation input files are out of date.
|
140
|
+
##
|
141
|
+
def out_of_date?
|
142
|
+
if !File.exist?(run_dir)
|
143
|
+
puts "run_dir '#{run_dir}' does not exist, simulation dir '#{run_dir}' out of date"
|
144
|
+
return true
|
145
|
+
end
|
146
|
+
|
147
|
+
if !File.exist?(finished_job_path)
|
148
|
+
puts "finished_job_path '#{finished_job_path}' does not exist, simulation dir '#{run_dir}' out of date"
|
149
|
+
return true
|
150
|
+
end
|
151
|
+
|
152
|
+
if !File.exist?(out_osw_path)
|
153
|
+
puts "out_osw_path '#{out_osw_path}' does not exist, simulation dir '#{run_dir}' out of date"
|
154
|
+
return true
|
155
|
+
end
|
156
|
+
out_osw_time = File.mtime(out_osw_path)
|
157
|
+
|
158
|
+
# array of files that this simulation dir depends on
|
159
|
+
dependencies = []
|
160
|
+
out_of_date_files = []
|
161
|
+
|
162
|
+
# depends on the in.osw
|
163
|
+
dependencies << in_osw_path
|
164
|
+
|
165
|
+
# depends on the feature file
|
166
|
+
dependencies << scenario.feature_file.path
|
167
|
+
|
168
|
+
# depends on the csv file
|
169
|
+
dependencies << scenario.csv_file
|
170
|
+
|
171
|
+
# depends on the mapper classes
|
172
|
+
Dir.glob(File.join(scenario.mapper_files_dir, '*')).each do |f|
|
173
|
+
dependencies << f
|
174
|
+
end
|
175
|
+
|
176
|
+
# depends on the root gemfile
|
177
|
+
dependencies << File.join(scenario.root_dir, 'Gemfile')
|
178
|
+
dependencies << File.join(scenario.root_dir, 'Gemfile.lock')
|
179
|
+
|
180
|
+
# todo, read in the in.osw and depend on all the measures
|
181
|
+
|
182
|
+
# check if out of date
|
183
|
+
dependencies.each do |f|
|
184
|
+
if File.exist?(f)
|
185
|
+
if File.mtime(f) > out_osw_time
|
186
|
+
out_of_date_files << f
|
187
|
+
end
|
188
|
+
else
|
189
|
+
puts "Dependency file '#{f}' does not exist"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
if !out_of_date_files.empty?
|
194
|
+
puts "Files [#{out_of_date_files.join(',')}] are newer than '#{out_osw_path}', simulation dir '#{run_dir}' out of date"
|
195
|
+
return true
|
196
|
+
end
|
197
|
+
|
198
|
+
return false
|
199
|
+
end
|
200
|
+
# rubocop: enable Metrics/AbcSize #:nodoc:
|
201
|
+
|
202
|
+
# rubocop: disable Style/GuardClause #:nodoc:
|
203
|
+
|
204
|
+
##
|
205
|
+
# Return simulation status one of {'Not Started', 'Started', 'Complete', 'Failed'}
|
206
|
+
##
|
207
|
+
def simulation_status
|
208
|
+
if File.exist?(failed_job_path)
|
209
|
+
return 'Failed'
|
210
|
+
elsif File.exist?(started_job_path)
|
211
|
+
if File.exist?(finished_job_path)
|
212
|
+
return 'Complete'
|
213
|
+
else
|
214
|
+
return 'Failed'
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
return 'Not Started'
|
219
|
+
end
|
220
|
+
# rubocop: enable Style/GuardClause #:nodoc:
|
221
|
+
|
222
|
+
##
|
223
|
+
# Clear the directory that this simulation runs in
|
224
|
+
##
|
225
|
+
def clear
|
226
|
+
dir = run_dir
|
227
|
+
FileUtils.mkdir_p(dir) if !File.exist?(dir)
|
228
|
+
Dir.glob(File.join(dir, '/*')).each do |f|
|
229
|
+
FileUtils.rm_rf(f)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
# rubocop: disable Security/Eval #:nodoc:
|
234
|
+
# rubocop: disable Style/EvalWithLocation #:nodoc:
|
235
|
+
|
236
|
+
##
|
237
|
+
# Create run directory and generate simulation OSW, all previous contents of directory are removed
|
238
|
+
# The simulation OSW is created by evaluating the mapper_class's create_osw method
|
239
|
+
##
|
240
|
+
def create_input_files
|
241
|
+
clear
|
242
|
+
|
243
|
+
dir = run_dir
|
244
|
+
osw = eval("#{@mapper_class}.new.create_osw(scenario, features, feature_names)")
|
245
|
+
osw_path = File.join(dir, 'in.osw')
|
246
|
+
File.open(osw_path, 'w') do |f|
|
247
|
+
f << JSON.pretty_generate(osw)
|
248
|
+
# make sure data is written to the disk one way or the other
|
249
|
+
begin
|
250
|
+
f.fsync
|
251
|
+
rescue StandardError
|
252
|
+
f.flush
|
253
|
+
end
|
254
|
+
end
|
255
|
+
return osw_path
|
256
|
+
end
|
257
|
+
# rubocop: enable Security/Eval #:nodoc:
|
258
|
+
# rubocop: enable Style/EvalWithLocation #:nodoc:
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
+
# contributors. All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
# are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
+
# of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
+
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
+
# materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
+
# used to endorse or promote products derived from this software without specific
|
17
|
+
# prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# *********************************************************************************
|
30
|
+
|
31
|
+
module URBANopt
|
32
|
+
module Scenario
|
33
|
+
class SimulationMapperBase
|
34
|
+
# perform initialization functions
|
35
|
+
def initialize; end
|
36
|
+
|
37
|
+
# create osw file given a ScenarioBase object, features, and feature_names
|
38
|
+
# [parameters:]
|
39
|
+
# +scenario+ - _ScenarioBase_ - An object of ScenarioBase class.
|
40
|
+
# +features+ - _Array_ - Array of Features.
|
41
|
+
# +feature_names+ - _Array_ - Array of scenario specific names for these Features.
|
42
|
+
def create_osw(scenario, features, feature_names)
|
43
|
+
raise 'create_osw not implemented for SimulationMapperBase, override in your class'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
|
+
# contributors. All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
# are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# Redistributions of source code must retain the above copyright notice, this list
|
9
|
+
# of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# Redistributions in binary form must reproduce the above copyright notice, this
|
12
|
+
# list of conditions and the following disclaimer in the documentation and/or other
|
13
|
+
# materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# Neither the name of the copyright holder nor the names of its contributors may be
|
16
|
+
# used to endorse or promote products derived from this software without specific
|
17
|
+
# prior written permission.
|
18
|
+
#
|
19
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# *********************************************************************************
|
30
|
+
|
31
|
+
module URBANopt
|
32
|
+
module Scenario
|
33
|
+
VERSION = '0.1.1'.freeze
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'urbanopt/scenario/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'urbanopt-scenario'
|
8
|
+
spec.version = URBANopt::Scenario::VERSION
|
9
|
+
spec.authors = ['Dan Macumber']
|
10
|
+
spec.email = ['daniel.macumber@nrel.gov']
|
11
|
+
|
12
|
+
spec.summary = 'Library to export data point OSW files from URBANopt Scenario CSV'
|
13
|
+
spec.description = 'Library to export data point OSW files from URBANopt Scenario CSV'
|
14
|
+
spec.homepage = 'https://github.com/urbanopt'
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = 'exe'
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ['lib']
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.14'
|
26
|
+
spec.add_development_dependency 'rake', '12.3.1'
|
27
|
+
spec.add_development_dependency 'rspec', '3.7.0'
|
28
|
+
|
29
|
+
spec.add_dependency 'json-schema'
|
30
|
+
spec.add_dependency 'json_pure'
|
31
|
+
spec.add_dependency 'openstudio-model-articulation', '~> 0.1.0'
|
32
|
+
spec.add_dependency 'urbanopt-core', '~> 0.1.0'
|
33
|
+
|
34
|
+
spec.add_dependency 'github_api'
|
35
|
+
|
36
|
+
# lock the version of these dependencies due to using older version of Ruby.
|
37
|
+
spec.add_dependency 'public_suffix', '3.1.1'
|
38
|
+
end
|