urbanopt-scenario 0.1.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -8
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +2 -10
  4. data/.github/pull_request_template.md +5 -15
  5. data/.rubocop.yml +1 -1
  6. data/CHANGELOG.md +45 -1
  7. data/{.github/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
  8. data/Gemfile +8 -12
  9. data/Jenkinsfile +2 -2
  10. data/Rakefile +2 -2
  11. data/docs/package-lock.json +4607 -6451
  12. data/docs/package.json +1 -1
  13. data/lib/measures/.rubocop.yml +1 -1
  14. data/lib/measures/default_feature_reports/LICENSE.md +1 -1
  15. data/lib/measures/default_feature_reports/README.md +5 -35
  16. data/lib/measures/default_feature_reports/measure.rb +315 -44
  17. data/lib/measures/default_feature_reports/measure.xml +38 -17
  18. data/lib/urbanopt/scenario.rb +1 -0
  19. data/lib/urbanopt/scenario/default_reports/distributed_generation.rb +209 -17
  20. data/lib/urbanopt/scenario/default_reports/feature_report.rb +57 -3
  21. data/lib/urbanopt/scenario/default_reports/power_distribution.rb +102 -0
  22. data/lib/urbanopt/scenario/default_reports/program.rb +6 -2
  23. data/lib/urbanopt/scenario/default_reports/reporting_period.rb +15 -9
  24. data/lib/urbanopt/scenario/default_reports/scenario_report.rb +24 -7
  25. data/lib/urbanopt/scenario/default_reports/schema/README.md +11 -12
  26. data/lib/urbanopt/scenario/default_reports/schema/scenario_csv_columns.txt +33 -12
  27. data/lib/urbanopt/scenario/default_reports/schema/scenario_schema.json +52 -25
  28. data/lib/urbanopt/scenario/default_reports/solar_pv.rb +1 -0
  29. data/lib/urbanopt/scenario/default_reports/timeseries_csv.rb +62 -21
  30. data/lib/urbanopt/scenario/scenario_post_processor_opendss.rb +276 -0
  31. data/lib/urbanopt/scenario/scenario_runner_osw.rb +21 -5
  32. data/lib/urbanopt/scenario/simulation_dir_osw.rb +0 -4
  33. data/lib/urbanopt/scenario/version.rb +1 -1
  34. data/urbanopt-scenario-gem.gemspec +10 -12
  35. metadata +31 -48
  36. data/.travis.yml +0 -23
  37. data/lib/change_log.rb +0 -147
  38. data/lib/measures/default_feature_reports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
  39. data/lib/measures/default_feature_reports/tests/default_feature_reports_test.rb +0 -238
  40. data/lib/measures/default_feature_reports/tests/example_model.osm +0 -4378
@@ -132,8 +132,6 @@ module URBANopt
132
132
  return result
133
133
  end
134
134
 
135
- # rubocop: disable Metrics/AbcSize #:nodoc:
136
-
137
135
  ##
138
136
  # Return true if the simulation is out of date (input files newer than results), false otherwise.
139
137
  # Non-existant simulation input files are out of date.
@@ -199,8 +197,6 @@ module URBANopt
199
197
  end
200
198
  # rubocop: enable Metrics/AbcSize #:nodoc:
201
199
 
202
- # rubocop: disable Style/GuardClause #:nodoc:
203
-
204
200
  ##
205
201
  # Return simulation status one of {'Not Started', 'Started', 'Complete', 'Failed'}
206
202
  ##
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module Scenario
33
- VERSION = '0.1.1'.freeze
33
+ VERSION = '0.3.0'.freeze
34
34
  end
35
35
  end
@@ -6,8 +6,8 @@ require 'urbanopt/scenario/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'urbanopt-scenario'
8
8
  spec.version = URBANopt::Scenario::VERSION
9
- spec.authors = ['Dan Macumber']
10
- spec.email = ['daniel.macumber@nrel.gov']
9
+ spec.authors = ['Rawad El Kontar', 'Dan Macumber']
10
+ spec.email = ['rawad.elkontar@nrel.gov']
11
11
 
12
12
  spec.summary = 'Library to export data point OSW files from URBANopt Scenario CSV'
13
13
  spec.description = 'Library to export data point OSW files from URBANopt Scenario CSV'
@@ -16,23 +16,21 @@ Gem::Specification.new do |spec|
16
16
  # Specify which files should be added to the gem when it is released.
17
17
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
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)/}) }
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|lib.measures.*tests|spec|features)/}) }
20
20
  end
21
21
  spec.bindir = 'exe'
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
+ spec.required_ruby_version = '~> 2.5.0'
24
25
 
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'
26
+ spec.add_development_dependency 'bundler', '~> 2.1'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
+ spec.add_development_dependency 'rspec', '~> 3.7'
28
29
 
29
30
  spec.add_dependency 'json-schema'
30
31
  spec.add_dependency 'json_pure'
31
- spec.add_dependency 'openstudio-model-articulation', '~> 0.1.0'
32
- spec.add_dependency 'urbanopt-core', '~> 0.1.0'
32
+ spec.add_dependency 'openstudio-common-measures', '~> 0.2.0'
33
+ spec.add_dependency 'openstudio-model-articulation', '~> 0.2.0'
34
+ spec.add_dependency 'urbanopt-core', '~> 0.3.0'
33
35
 
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
36
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-scenario
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
+ - Rawad El Kontar
7
8
  - Dan Macumber
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
12
+ date: 2020-06-05 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -16,42 +17,42 @@ dependencies:
16
17
  requirements:
17
18
  - - "~>"
18
19
  - !ruby/object:Gem::Version
19
- version: '1.14'
20
+ version: '2.1'
20
21
  type: :development
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
25
  - - "~>"
25
26
  - !ruby/object:Gem::Version
26
- version: '1.14'
27
+ version: '2.1'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rake
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - '='
32
+ - - "~>"
32
33
  - !ruby/object:Gem::Version
33
- version: 12.3.1
34
+ version: '13.0'
34
35
  type: :development
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - '='
39
+ - - "~>"
39
40
  - !ruby/object:Gem::Version
40
- version: 12.3.1
41
+ version: '13.0'
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rspec
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - '='
46
+ - - "~>"
46
47
  - !ruby/object:Gem::Version
47
- version: 3.7.0
48
+ version: '3.7'
48
49
  type: :development
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - '='
53
+ - - "~>"
53
54
  - !ruby/object:Gem::Version
54
- version: 3.7.0
55
+ version: '3.7'
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: json-schema
57
58
  requirement: !ruby/object:Gem::Requirement
@@ -81,69 +82,54 @@ dependencies:
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  - !ruby/object:Gem::Dependency
84
- name: openstudio-model-articulation
85
+ name: openstudio-common-measures
85
86
  requirement: !ruby/object:Gem::Requirement
86
87
  requirements:
87
88
  - - "~>"
88
89
  - !ruby/object:Gem::Version
89
- version: 0.1.0
90
+ version: 0.2.0
90
91
  type: :runtime
91
92
  prerelease: false
92
93
  version_requirements: !ruby/object:Gem::Requirement
93
94
  requirements:
94
95
  - - "~>"
95
96
  - !ruby/object:Gem::Version
96
- version: 0.1.0
97
+ version: 0.2.0
97
98
  - !ruby/object:Gem::Dependency
98
- name: urbanopt-core
99
+ name: openstudio-model-articulation
99
100
  requirement: !ruby/object:Gem::Requirement
100
101
  requirements:
101
102
  - - "~>"
102
103
  - !ruby/object:Gem::Version
103
- version: 0.1.0
104
+ version: 0.2.0
104
105
  type: :runtime
105
106
  prerelease: false
106
107
  version_requirements: !ruby/object:Gem::Requirement
107
108
  requirements:
108
109
  - - "~>"
109
110
  - !ruby/object:Gem::Version
110
- version: 0.1.0
111
+ version: 0.2.0
111
112
  - !ruby/object:Gem::Dependency
112
- name: github_api
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: public_suffix
113
+ name: urbanopt-core
127
114
  requirement: !ruby/object:Gem::Requirement
128
115
  requirements:
129
- - - '='
116
+ - - "~>"
130
117
  - !ruby/object:Gem::Version
131
- version: 3.1.1
118
+ version: 0.3.0
132
119
  type: :runtime
133
120
  prerelease: false
134
121
  version_requirements: !ruby/object:Gem::Requirement
135
122
  requirements:
136
- - - '='
123
+ - - "~>"
137
124
  - !ruby/object:Gem::Version
138
- version: 3.1.1
125
+ version: 0.3.0
139
126
  description: Library to export data point OSW files from URBANopt Scenario CSV
140
127
  email:
141
- - daniel.macumber@nrel.gov
128
+ - rawad.elkontar@nrel.gov
142
129
  executables: []
143
130
  extensions: []
144
131
  extra_rdoc_files: []
145
132
  files:
146
- - ".github/CONTRIBUTING.md"
147
133
  - ".github/ISSUE_TEMPLATE/bug_report.md"
148
134
  - ".github/ISSUE_TEMPLATE/feature_request.md"
149
135
  - ".github/pull_request_template.md"
@@ -151,8 +137,8 @@ files:
151
137
  - ".rdoc_options"
152
138
  - ".rspec"
153
139
  - ".rubocop.yml"
154
- - ".travis.yml"
155
140
  - CHANGELOG.md
141
+ - CONTRIBUTING.md
156
142
  - Gemfile
157
143
  - Jenkinsfile
158
144
  - LICENSE.md
@@ -178,16 +164,12 @@ files:
178
164
  - docs/package-lock.json
179
165
  - docs/package.json
180
166
  - docs/schemas/scenario-schema.md
181
- - lib/change_log.rb
182
167
  - lib/measures/.rubocop.yml
183
168
  - lib/measures/default_feature_reports/LICENSE.md
184
169
  - lib/measures/default_feature_reports/README.md
185
170
  - lib/measures/default_feature_reports/README.md.erb
186
171
  - lib/measures/default_feature_reports/measure.rb
187
172
  - lib/measures/default_feature_reports/measure.xml
188
- - lib/measures/default_feature_reports/tests/USA_CO_Golden-NREL.724666_TMY3.epw
189
- - lib/measures/default_feature_reports/tests/default_feature_reports_test.rb
190
- - lib/measures/default_feature_reports/tests/example_model.osm
191
173
  - lib/urbanopt-scenario.rb
192
174
  - lib/urbanopt/scenario.rb
193
175
  - lib/urbanopt/scenario/default_reports.rb
@@ -200,6 +182,7 @@ files:
200
182
  - lib/urbanopt/scenario/default_reports/generator.rb
201
183
  - lib/urbanopt/scenario/default_reports/location.rb
202
184
  - lib/urbanopt/scenario/default_reports/logger.rb
185
+ - lib/urbanopt/scenario/default_reports/power_distribution.rb
203
186
  - lib/urbanopt/scenario/default_reports/program.rb
204
187
  - lib/urbanopt/scenario/default_reports/reporting_period.rb
205
188
  - lib/urbanopt/scenario/default_reports/scenario_report.rb
@@ -218,6 +201,7 @@ files:
218
201
  - lib/urbanopt/scenario/scenario_datapoint_base.rb
219
202
  - lib/urbanopt/scenario/scenario_post_processor_base.rb
220
203
  - lib/urbanopt/scenario/scenario_post_processor_default.rb
204
+ - lib/urbanopt/scenario/scenario_post_processor_opendss.rb
221
205
  - lib/urbanopt/scenario/scenario_runner_base.rb
222
206
  - lib/urbanopt/scenario/scenario_runner_osw.rb
223
207
  - lib/urbanopt/scenario/simulation_dir_base.rb
@@ -234,17 +218,16 @@ require_paths:
234
218
  - lib
235
219
  required_ruby_version: !ruby/object:Gem::Requirement
236
220
  requirements:
237
- - - ">="
221
+ - - "~>"
238
222
  - !ruby/object:Gem::Version
239
- version: '0'
223
+ version: 2.5.0
240
224
  required_rubygems_version: !ruby/object:Gem::Requirement
241
225
  requirements:
242
226
  - - ">="
243
227
  - !ruby/object:Gem::Version
244
228
  version: '0'
245
229
  requirements: []
246
- rubyforge_project:
247
- rubygems_version: 2.4.5.1
230
+ rubygems_version: 3.1.2
248
231
  signing_key:
249
232
  specification_version: 4
250
233
  summary: Library to export data point OSW files from URBANopt Scenario CSV
@@ -1,23 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- #cache: bundler
5
- rvm:
6
- - 2.2.4
7
- matrix:
8
- include:
9
- - env: OPENSTUDIO_VERSION=2.7.0 && OPENSTUDIO_SHA=544f363db5 && RUBYLIB=/usr/local/openstudio-2.7.0/Ruby:/usr/Ruby
10
- before_install:
11
- - gem install bundler -v '1.17'
12
- - gem install bundler -v '~> 1.17'
13
- install:
14
- - bundle install
15
- before_script:
16
- - curl -sLO https://raw.githubusercontent.com/NREL/OpenStudio-server/develop/docker/deployment/scripts/install_openstudio.sh
17
- - chmod +x install_openstudio.sh
18
- - sudo ./install_openstudio.sh $OPENSTUDIO_VERSION $OPENSTUDIO_SHA
19
- - sudo ./install_openstudio.sh $OPENSTUDIO_VERSION $OPENSTUDIO_SHA
20
- script:
21
- - bundle exec rake
22
- - bundle exec rake
23
-
@@ -1,147 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'github_api'
4
- require 'date'
5
- require 'optparse'
6
- require 'optparse/date'
7
-
8
- # Instructions:
9
- # Get a token from github's settings (https://github.com/settings/tokens)
10
- #
11
- # Example:
12
- # ruby change_log.rb -t abcdefghijklmnopqrstuvwxyz -s 2017-09-06
13
- #
14
-
15
- options = {}
16
- OptionParser.new do |opts|
17
- opts.banner = "Usage: change_log.rb [options]\n" \
18
- 'Prints New, Open, Closed Issues, and number of accepted PRs'
19
- opts.separator ''
20
-
21
- # defaults, go back 90 days
22
- options[:start_date] = Date.today - 90
23
- options[:end_date] = Date.today
24
-
25
- opts.on('-s', '--start-date [DATE]', Date, 'Start of data (e.g. 2017-09-06)') do |v|
26
- options[:start_date] = v
27
- end
28
- opts.on('-e', '--end-date [DATE]', Date, 'End of data (e.g. 2017-09-13)') do |v|
29
- options[:end_date] = v
30
- end
31
- opts.on('-t', '--token [String]', String, 'Github API Token') do |v|
32
- options[:token] = v
33
- end
34
- end.parse!
35
-
36
- # Convert dates to time objects
37
- options[:start_date] = Time.parse(options[:start_date].to_s)
38
- options[:end_date] = Time.parse(options[:end_date].to_s)
39
- puts options
40
-
41
- ### Repository options
42
- repo_owner = 'URBANopt'
43
- repo = 'urbanopt-scenario-gem'
44
-
45
- github = Github.new
46
- if options[:token]
47
- puts 'Using github token'
48
- github = Github.new oauth_token: options[:token]
49
- end
50
-
51
- total_open_issues = []
52
- total_open_pull_requests = []
53
- new_issues = []
54
- closed_issues = []
55
- accepted_pull_requests = []
56
-
57
- def get_num(issue)
58
- issue.html_url.split('/')[-1].to_i
59
- end
60
-
61
- def get_issue_num(issue)
62
- "\##{get_num(issue)}"
63
- end
64
-
65
- def get_html_url(issue)
66
- issue.html_url
67
- end
68
-
69
- def get_title(issue)
70
- issue.title
71
- end
72
-
73
- def print_issue(issue)
74
- is_feature = false
75
- issue.labels.each { |label| is_feature = true if label.name == 'Feature Request' }
76
-
77
- if is_feature
78
- "- Improved [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
79
- else
80
- "- Fixed [#{get_issue_num(issue)}]( #{get_html_url(issue)} ), #{get_title(issue)}"
81
- end
82
- end
83
-
84
- # Process Open Issues
85
- results = -1
86
- page = 1
87
- while results != 0
88
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
89
- state: 'open', per_page: 100, page: page
90
- results = resp.length
91
- resp.env[:body].each do |issue, _index|
92
- created = Time.parse(issue.created_at)
93
- if !issue.key?(:pull_request)
94
- total_open_issues << issue
95
- if created >= options[:start_date] && created <= options[:end_date]
96
- new_issues << issue
97
- end
98
- else
99
- total_open_pull_requests << issue
100
- end
101
- end
102
-
103
- page += 1
104
- end
105
-
106
- # Process Closed Issues
107
- results = -1
108
- page = 1
109
- while results != 0
110
- resp = github.issues.list user: repo_owner, repo: repo, sort: 'created', direction: 'asc',
111
- state: 'closed', per_page: 100, page: page
112
- results = resp.length
113
- resp.env[:body].each do |issue, _index|
114
- created = Time.parse(issue.created_at)
115
- closed = Time.parse(issue.closed_at)
116
- if !issue.key?(:pull_request)
117
- if created >= options[:start_date] && created <= options[:end_date]
118
- new_issues << issue
119
- end
120
- if closed >= options[:start_date] && closed <= options[:end_date]
121
- closed_issues << issue
122
- end
123
- elsif closed >= options[:start_date] && closed <= options[:end_date]
124
- accepted_pull_requests << issue
125
- end
126
- end
127
-
128
- page += 1
129
- end
130
-
131
- closed_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
132
- new_issues.sort! { |x, y| get_num(x) <=> get_num(y) }
133
- accepted_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
134
- total_open_pull_requests.sort! { |x, y| get_num(x) <=> get_num(y) }
135
-
136
- puts "Total Open Issues: #{total_open_issues.length}"
137
- puts "Total Open Pull Requests: #{total_open_pull_requests.length}"
138
- puts "\nDate Range: #{options[:start_date].strftime('%m/%d/%y')} - #{options[:end_date].strftime('%m/%d/%y')}:"
139
- puts "\nNew Issues: #{new_issues.length} (" + new_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'
140
-
141
- puts "\nClosed Issues: #{closed_issues.length}"
142
- closed_issues.each { |issue| puts print_issue(issue) }
143
-
144
- puts "\nAccepted Pull Requests: #{accepted_pull_requests.length}"
145
- accepted_pull_requests.each { |issue| puts print_issue(issue) }
146
-
147
- puts "\nAll Open Issues: #{total_open_issues.length} (" + total_open_issues.map { |issue| get_issue_num(issue) }.join(', ') + ')'