urbanopt-scenario 0.1.1 → 0.2.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  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/{.github/CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
  6. data/Gemfile +4 -2
  7. data/Jenkinsfile +2 -2
  8. data/Rakefile +1 -1
  9. data/docs/package-lock.json +4607 -6451
  10. data/docs/package.json +1 -1
  11. data/lib/measures/default_feature_reports/LICENSE.md +1 -1
  12. data/lib/measures/default_feature_reports/README.md +1 -1
  13. data/lib/measures/default_feature_reports/measure.rb +256 -41
  14. data/lib/measures/default_feature_reports/measure.xml +19 -15
  15. data/lib/urbanopt/scenario/default_reports/distributed_generation.rb +204 -17
  16. data/lib/urbanopt/scenario/default_reports/feature_report.rb +47 -0
  17. data/lib/urbanopt/scenario/default_reports/program.rb +6 -1
  18. data/lib/urbanopt/scenario/default_reports/reporting_period.rb +5 -2
  19. data/lib/urbanopt/scenario/default_reports/scenario_report.rb +17 -6
  20. data/lib/urbanopt/scenario/default_reports/schema/README.md +11 -12
  21. data/lib/urbanopt/scenario/default_reports/schema/scenario_csv_columns.txt +14 -6
  22. data/lib/urbanopt/scenario/default_reports/schema/scenario_schema.json +27 -18
  23. data/lib/urbanopt/scenario/default_reports/solar_pv.rb +1 -0
  24. data/lib/urbanopt/scenario/default_reports/timeseries_csv.rb +29 -3
  25. data/lib/urbanopt/scenario/scenario_runner_osw.rb +21 -5
  26. data/lib/urbanopt/scenario/version.rb +1 -1
  27. data/urbanopt-scenario-gem.gemspec +7 -5
  28. metadata +39 -25
  29. data/.travis.yml +0 -23
@@ -18,17 +18,16 @@ The URBANopt Scenario Gem includes functionality for defining scenarios, running
18
18
 
19
19
  | output | unit |
20
20
  | -----------------------------------------| ------- |
21
- | Electricity:Facility | kbtu |
22
- | ElectricityProduced:Facility | kbtu |
23
- | Gas:Facility | kbtu |
24
- | DistrictCooling:Facility | kbtu |
25
- | DistrictHeating:Facility | kbtu |
21
+ | Electricity:Facility | kWh |
22
+ | ElectricityProduced:Facility | kWh |
23
+ | Gas:Facility | kBtu |
24
+ | DistrictCooling:Facility | kWh |
25
+ | DistrictHeating:Facility | kWh |
26
26
  | District Cooling Chilled Water Rate | GPM |
27
- | District Cooling Mass Flow Rate | lbs/min |
28
- | District Cooling Inlet Temperature | °F |
29
- | District Cooling Outlet Temperature | °F |
27
+ | District Cooling Mass Flow Rate | kg/s |
28
+ | District Cooling Inlet Temperature | °C |
29
+ | District Cooling Outlet Temperature | °C |
30
30
  | District Heating Hot Water Rate | GPM |
31
- | District Heating Mass Flow Rate | lbs/min |
32
- | District Heating Inlet Temperature | °F |
33
- | District Heating Outlet Temperature | °F |
34
- | Electricity:Grid:ToLoad | kWh. |
31
+ | District Heating Mass Flow Rate | kg/s |
32
+ | District Heating Inlet Temperature | °C |
33
+ | District Heating Outlet Temperature | °C |
@@ -1,13 +1,21 @@
1
- Electricity:Facility
1
+ Datetime
2
+ Electricity:Facility
2
3
  ElectricityProduced:Facility
3
- Gas:Facility
4
+ Gas:Facility
4
5
  DistrictCooling:Facility
5
6
  DistrictHeating:Facility
6
7
  District Cooling Chilled Water Rate
7
- District Cooling Mass Flow Rate
8
+ District Cooling Mass Flow Rate
8
9
  District Cooling Inlet Temperature
9
10
  District Cooling Outlet Temperature
10
- District Heating Hot Water Rate
11
- District Heating Mass Flow Rate
12
- District Heating Inlet Temperature
11
+ District Heating Hot Water Rate
12
+ District Heating Mass Flow Rate
13
+ District Heating Inlet Temperature
13
14
  District Heating Outlet Temperature
15
+ Net Electric Energy
16
+ Electricity:Facility Power
17
+ ElectricityProduced:Facility Power
18
+ Electricity:Facility Apparent Power
19
+ ElectricityProduced:Facility Apparent Power
20
+ Net Power
21
+ Net Apparent Power
@@ -64,7 +64,6 @@
64
64
  "distributed_generation": {
65
65
  "$ref": "#/definitions/DistributedGeneration"
66
66
  }
67
-
68
67
  },
69
68
  "required": [
70
69
  "id",
@@ -83,42 +82,42 @@
83
82
  "type": "object",
84
83
  "properties": {
85
84
  "lcc_us_dollars": {
86
- "type": "number",
87
- "description": "Optimal lifecycle cost"
85
+ "description": "Optimal lifecycle cost",
86
+ "type": "number"
88
87
  },
89
88
  "npv_us_dollars": {
90
- "type": "number",
91
- "description": "Net present value of savings realized by the project"
89
+ "description": "Net present value of savings realized by the project",
90
+ "type": "number"
92
91
  },
93
92
  "year_one_energy_cost_us_dollars": {
94
- "type": "number",
95
- "description": "Optimal year one utility energy cost"
93
+ "description": "Optimal year one utility energy cost",
94
+ "type": "number"
96
95
  },
97
96
  "year_one_demand_cost_us_dollars": {
98
- "type": "number",
99
- "description": "Optimal year one utility demand cost"
97
+ "description": "Optimal year one utility demand cost",
98
+ "type": "number"
100
99
  },
101
100
  "year_one_bill_us_dollars": {
102
- "type": "number",
103
- "description": "Optimal year one utility bill"
101
+ "description": "Optimal year one utility bill",
102
+ "type": "number"
104
103
  },
105
104
  "total_energy_cost_us_dollars": {
106
- "type": "number",
107
- "description": "Total utility energy cost over the lifecycle, after-tax"
105
+ "description": "Total utility energy cost over the lifecycle, after-tax",
106
+ "type": "number"
108
107
  },
109
- "SolarPV" : {
108
+ "SolarPV": {
110
109
  "$ref": "#/definitions/SolarPV"
111
110
  },
112
- "Wind" : {
111
+ "Wind": {
113
112
  "$ref": "#/definitions/Wind"
114
113
  },
115
- "Generator" : {
114
+ "Generator": {
116
115
  "$ref": "#/definitions/Generator"
117
116
  },
118
- "Storage" : {
117
+ "Storage": {
119
118
  "$ref": "#/definitions/Storage"
120
119
  }
121
- }
120
+ }
122
121
  },
123
122
  "SolarPV": {
124
123
  "type": "object",
@@ -436,6 +435,12 @@
436
435
  "time_setpoint_not_met_during_occupied_hours": {
437
436
  "description": "(hrs)",
438
437
  "type": "number"
438
+ },
439
+ "hours_out_of_comfort_bounds_PMV": {
440
+ "type": "number"
441
+ },
442
+ "hours_out_of_comfort_bounds_PPD": {
443
+ "type": "number"
439
444
  }
440
445
  },
441
446
  "additionalProperties": false
@@ -709,6 +714,10 @@
709
714
  "aspect_ratio": {
710
715
  "description": "Ratio of longest to shortest axis",
711
716
  "type": "number"
717
+ },
718
+ "total_construction_cost": {
719
+ "description": "total construction cost calculated from the defined cost per floor area ($)",
720
+ "type": "number"
712
721
  }
713
722
  },
714
723
  "required": [
@@ -54,6 +54,7 @@ module URBANopt
54
54
  hash.delete_if { |k, v| v.nil? }
55
55
 
56
56
  @size_kw = hash[:size_kw]
57
+ @id = hash[:id]
57
58
 
58
59
  # initialize class variables @@validator and @@schema
59
60
  @@validator ||= Validator.new
@@ -56,7 +56,12 @@ module URBANopt
56
56
 
57
57
  @path = hash[:path]
58
58
  @first_report_datetime = hash[:first_report_datetime]
59
+
60
+ # from scenario csv shema get required reults to be aggregated
61
+ @required_column_names = load_scenario_csv_schema_headers
62
+
59
63
  @column_names = hash[:column_names]
64
+ @column_names.delete_if { |x| !@required_column_names.include? x.split('(')[0] }
60
65
 
61
66
  # hash of column_name to array of values, does not get serialized to hash
62
67
  @mutex = Mutex.new
@@ -70,6 +75,23 @@ module URBANopt
70
75
  @@logger ||= URBANopt::Scenario::DefaultReports.logger
71
76
  end
72
77
 
78
+ ##
79
+ # load required scenario report csv headers from reports schema
80
+ ##
81
+ def load_scenario_csv_schema_headers
82
+ # rubocop: disable Security/Open
83
+ scenario_csv_schema = open(File.expand_path('../default_reports/schema/scenario_csv_columns.txt', File.dirname(__FILE__)))
84
+ # rubocop: enable Security/Open
85
+
86
+ scenario_csv_schema_headers = []
87
+ File.readlines(scenario_csv_schema).each do |line|
88
+ l = line.delete("\n")
89
+ a = l.delete("\t")
90
+ scenario_csv_schema_headers << a
91
+ end
92
+ return scenario_csv_schema_headers
93
+ end
94
+
73
95
  ##
74
96
  # Assigns default values if values does not exist.
75
97
  ##
@@ -153,7 +175,7 @@ module URBANopt
153
175
  end
154
176
  else
155
177
  row.each_with_index do |value, i|
156
- @data[@column_names[i]] << value.to_f
178
+ @data[@column_names[i]] << value
157
179
  end
158
180
  end
159
181
  end
@@ -214,7 +236,7 @@ module URBANopt
214
236
  ##
215
237
  def add_timeseries_csv(other)
216
238
  # initialize first_report_datetime with the incoming first_report_datetime if its nil.
217
- if @first_report_datetime.nil?
239
+ if @first_report_datetime.nil? || @first_report_datetime == ''
218
240
  @first_report_datetime = other.first_report_datetime
219
241
  end
220
242
 
@@ -239,12 +261,16 @@ module URBANopt
239
261
  end
240
262
 
241
263
  current_values = @data[column_name]
264
+
242
265
  if current_values
243
266
  if current_values.size != new_values.size
244
267
  raise 'Values of different sizes in add_timeseries_csv'
245
268
  end
246
269
  new_values.each_with_index do |value, i|
247
- new_values[i] = value + current_values[i]
270
+ # aggregate all columns except Datime column
271
+ if column_name != 'Datetime'
272
+ new_values[i] = value.to_f + current_values[i].to_f
273
+ end
248
274
  end
249
275
  @data[column_name] = new_values
250
276
  else
@@ -132,7 +132,7 @@ module URBANopt
132
132
  end
133
133
  end
134
134
 
135
- # Run osw groups in order and store simulation failure in a array.
135
+ # Run osw groups in order and store simulation failure in an array.
136
136
  # Return simulation_dirs after running all simulations.
137
137
 
138
138
  # failures
@@ -140,17 +140,33 @@ module URBANopt
140
140
  # run building_osws
141
141
  # building_failures = runner.run_osws(building_osws, num_parallel = Extension::NUM_PARALLEL, max_to_run = Extension::MAX_DATAPOINTS)
142
142
  building_failures = runner.run_osws(building_osws)
143
- failures << building_failures
143
+ failures + building_failures
144
144
  # run district_system_osws
145
145
  # district_system_failures = runner.run_osws(district_system_osws, num_parallel = Extension::NUM_PARALLEL, max_to_run = Extension::MAX_DATAPOINTS)
146
146
  district_system_failures = runner.run_osws(district_system_osws)
147
- failures << district_system_failures
147
+ failures + district_system_failures
148
148
  # run transformer_osws
149
149
  # transformer_failures = runner.run_osws(transformer_osws, num_parallel = Extension::NUM_PARALLEL, max_to_run = Extension::MAX_DATAPOINTS)
150
150
  transformer_failures = runner.run_osws(transformer_osws)
151
- failures << transformer_failures
151
+ failures + transformer_failures
152
+
153
+ puts 'Done Running Scenario'
154
+
155
+ # if failures.size > 0
156
+ # puts "DATAPOINT FAILURES: #{failures}"
157
+ # end
158
+
159
+ # look for other failed datapoints
160
+ failed_sims = []
161
+ simulation_dirs.each do |simulation_dir|
162
+ if File.exist?(File.join(simulation_dir.run_dir, 'failed.job'))
163
+ failed_sims << simulation_dir.run_dir.split('/')[-1]
164
+ end
165
+ end
166
+ if !failed_sims.empty?
167
+ puts "FAILED SIMULATION IDs: #{failed_sims.join(',')}"
168
+ end
152
169
 
153
- # puts "failures = #{failures}"
154
170
  return simulation_dirs
155
171
  end
156
172
  end
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module Scenario
33
- VERSION = '0.1.1'.freeze
33
+ VERSION = '0.2.0.pre1'.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'
@@ -21,18 +21,20 @@ Gem::Specification.new do |spec|
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.2.4'
24
25
 
25
26
  spec.add_development_dependency 'bundler', '~> 1.14'
26
27
  spec.add_development_dependency 'rake', '12.3.1'
27
28
  spec.add_development_dependency 'rspec', '3.7.0'
29
+ spec.add_development_dependency 'github_api', '~> 0.18.0'
30
+ # Fix rack version temporarily to work with Ruby 2.2.4
31
+ spec.add_development_dependency 'rack', '2.1.2'
28
32
 
29
33
  spec.add_dependency 'json-schema'
30
34
  spec.add_dependency 'json_pure'
31
- spec.add_dependency 'openstudio-model-articulation', '~> 0.1.0'
35
+ spec.add_dependency 'openstudio-model-articulation', '~> 0.1.1'
32
36
  spec.add_dependency 'urbanopt-core', '~> 0.1.0'
33
37
 
34
- spec.add_dependency 'github_api'
35
-
36
38
  # lock the version of these dependencies due to using older version of Ruby.
37
39
  spec.add_dependency 'public_suffix', '3.1.1'
38
40
  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.2.0.pre1
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-03-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
@@ -52,6 +53,34 @@ dependencies:
52
53
  - - '='
53
54
  - !ruby/object:Gem::Version
54
55
  version: 3.7.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: github_api
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.18.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.18.0
70
+ - !ruby/object:Gem::Dependency
71
+ name: rack
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '='
75
+ - !ruby/object:Gem::Version
76
+ version: 2.1.2
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '='
82
+ - !ruby/object:Gem::Version
83
+ version: 2.1.2
55
84
  - !ruby/object:Gem::Dependency
56
85
  name: json-schema
57
86
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +115,14 @@ dependencies:
86
115
  requirements:
87
116
  - - "~>"
88
117
  - !ruby/object:Gem::Version
89
- version: 0.1.0
118
+ version: 0.1.1
90
119
  type: :runtime
91
120
  prerelease: false
92
121
  version_requirements: !ruby/object:Gem::Requirement
93
122
  requirements:
94
123
  - - "~>"
95
124
  - !ruby/object:Gem::Version
96
- version: 0.1.0
125
+ version: 0.1.1
97
126
  - !ruby/object:Gem::Dependency
98
127
  name: urbanopt-core
99
128
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +137,6 @@ dependencies:
108
137
  - - "~>"
109
138
  - !ruby/object:Gem::Version
110
139
  version: 0.1.0
111
- - !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
140
  - !ruby/object:Gem::Dependency
126
141
  name: public_suffix
127
142
  requirement: !ruby/object:Gem::Requirement
@@ -138,12 +153,11 @@ dependencies:
138
153
  version: 3.1.1
139
154
  description: Library to export data point OSW files from URBANopt Scenario CSV
140
155
  email:
141
- - daniel.macumber@nrel.gov
156
+ - rawad.elkontar@nrel.gov
142
157
  executables: []
143
158
  extensions: []
144
159
  extra_rdoc_files: []
145
160
  files:
146
- - ".github/CONTRIBUTING.md"
147
161
  - ".github/ISSUE_TEMPLATE/bug_report.md"
148
162
  - ".github/ISSUE_TEMPLATE/feature_request.md"
149
163
  - ".github/pull_request_template.md"
@@ -151,8 +165,8 @@ files:
151
165
  - ".rdoc_options"
152
166
  - ".rspec"
153
167
  - ".rubocop.yml"
154
- - ".travis.yml"
155
168
  - CHANGELOG.md
169
+ - CONTRIBUTING.md
156
170
  - Gemfile
157
171
  - Jenkinsfile
158
172
  - LICENSE.md
@@ -234,14 +248,14 @@ require_paths:
234
248
  - lib
235
249
  required_ruby_version: !ruby/object:Gem::Requirement
236
250
  requirements:
237
- - - ">="
251
+ - - "~>"
238
252
  - !ruby/object:Gem::Version
239
- version: '0'
253
+ version: 2.2.4
240
254
  required_rubygems_version: !ruby/object:Gem::Requirement
241
255
  requirements:
242
- - - ">="
256
+ - - ">"
243
257
  - !ruby/object:Gem::Version
244
- version: '0'
258
+ version: 1.3.1
245
259
  requirements: []
246
260
  rubyforge_project:
247
261
  rubygems_version: 2.4.5.1