urbanopt-reporting 0.1.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
  4. data/.github/pull_request_template.md +13 -0
  5. data/.rdoc_options +36 -0
  6. data/CHANGELOG.md +41 -1
  7. data/CONTRIBUTING.md +1 -1
  8. data/LICENSE.md +1 -1
  9. data/RDOC_MAIN.md +10 -0
  10. data/README.md +1 -1
  11. data/Rakefile +1 -1
  12. data/deploy_docs.sh +5 -0
  13. data/doc_templates/LICENSE.md +1 -1
  14. data/doc_templates/copyright_erb.txt +1 -1
  15. data/doc_templates/copyright_js.txt +1 -1
  16. data/doc_templates/copyright_ruby.txt +1 -1
  17. data/docs/.gitignore +3 -0
  18. data/docs/.vuepress/components/InnerJsonSchema.vue +76 -0
  19. data/docs/.vuepress/components/JsonSchema.vue +12 -0
  20. data/docs/.vuepress/components/ScenarioSchema.vue +12 -0
  21. data/docs/.vuepress/components/StaticLink.vue +8 -0
  22. data/docs/.vuepress/config.js +25 -0
  23. data/docs/.vuepress/highlight.js +8 -0
  24. data/docs/.vuepress/json-schema-deref-loader.js +22 -0
  25. data/docs/.vuepress/public/custom_rdoc_styles.css +78 -0
  26. data/docs/.vuepress/styles/palette.styl +1 -0
  27. data/docs/.vuepress/utils.js +17 -0
  28. data/docs/README.md +9 -0
  29. data/docs/package-lock.json +10018 -0
  30. data/docs/package.json +30 -0
  31. data/docs/schemas/scenario-schema.md +3 -0
  32. data/lib/measures/default_feature_reports/LICENSE.md +1 -1
  33. data/lib/measures/default_feature_reports/measure.rb +191 -84
  34. data/lib/measures/default_feature_reports/measure.xml +11 -11
  35. data/lib/urbanopt/reporting.rb +1 -1
  36. data/lib/urbanopt/reporting/default_reports.rb +1 -1
  37. data/lib/urbanopt/reporting/default_reports/construction_cost.rb +1 -1
  38. data/lib/urbanopt/reporting/default_reports/date.rb +1 -1
  39. data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +119 -6
  40. data/lib/urbanopt/reporting/default_reports/end_use.rb +1 -1
  41. data/lib/urbanopt/reporting/default_reports/end_uses.rb +53 -39
  42. data/lib/urbanopt/reporting/default_reports/extension.rb +30 -0
  43. data/lib/urbanopt/reporting/default_reports/feature_report.rb +42 -19
  44. data/lib/urbanopt/reporting/default_reports/generator.rb +2 -2
  45. data/lib/urbanopt/reporting/default_reports/location.rb +12 -12
  46. data/lib/urbanopt/reporting/default_reports/logger.rb +1 -1
  47. data/lib/urbanopt/reporting/default_reports/power_distribution.rb +1 -1
  48. data/lib/urbanopt/reporting/default_reports/program.rb +87 -87
  49. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +87 -79
  50. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +1 -1
  51. data/lib/urbanopt/reporting/default_reports/schema/README.md +1 -1
  52. data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +15 -0
  53. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +97 -81
  54. data/lib/urbanopt/reporting/default_reports/solar_pv.rb +2 -2
  55. data/lib/urbanopt/reporting/default_reports/storage.rb +2 -2
  56. data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +11 -11
  57. data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +1 -1
  58. data/lib/urbanopt/reporting/default_reports/validator.rb +1 -1
  59. data/lib/urbanopt/reporting/default_reports/wind.rb +2 -2
  60. data/lib/urbanopt/reporting/derived_extension.rb +1 -1
  61. data/lib/urbanopt/reporting/version.rb +2 -2
  62. data/urbanopt-reporting-gem.gemspec +4 -4
  63. metadata +35 -13
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "urbanopt-reporting-gem-docs",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "dev": "vuepress dev",
8
+ "build": "vuepress build",
9
+ "deploy": "gh-pages -d .vuepress/dist"
10
+ },
11
+ "author": "NREL",
12
+ "dependencies": {
13
+ "highlight.js": "^10.4.1",
14
+ "json-schema-ref-parser": "^9.0.6",
15
+ "json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
16
+ "vuepress": "^1.7.1",
17
+ "webpack-dev-middleware": "^3.6.0"
18
+ },
19
+ "devDependencies": {
20
+ "braces": "^3.0.2",
21
+ "dot-prop": "^5.3.0",
22
+ "gh-pages": "^3.1.0",
23
+ "js-yaml": "^3.14.0",
24
+ "minimist": ">=1.2.3",
25
+ "node-forge": ">=0.10.0",
26
+ "serialize-javascript": "^5.0.1",
27
+ "set-value": "^3.0.2",
28
+ "yargs-parser": "^20.2.3"
29
+ }
30
+ }
@@ -0,0 +1,3 @@
1
+ # Scenario Schema
2
+
3
+ <ScenarioSchema />
@@ -1,4 +1,4 @@
1
- URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
1
+ URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
2
  contributors. All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without modification,
@@ -1,5 +1,5 @@
1
1
  # *********************************************************************************
2
- # URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
3
  # contributors. All rights reserved.
4
4
  #
5
5
  # Redistribution and use in source and binary forms, with or without modification,
@@ -99,37 +99,39 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
99
99
 
100
100
  # define fuel types
101
101
  def fuel_types
102
- fuel_types = [
103
- 'Electricity',
104
- 'Gas',
105
- 'AdditionalFuel',
106
- 'DistrictCooling',
107
- 'DistrictHeating',
108
- 'Water'
109
- ]
102
+ fuel_types = {
103
+ 'Electricity' => 'Electricity',
104
+ 'Gas' => 'Natural Gas',
105
+ 'FuelOil#2' => 'Fuel Oil #2',
106
+ 'Propane' => 'Propane',
107
+ 'AdditionalFuel' => 'Additional Fuel',
108
+ 'DistrictCooling' => 'District Cooling',
109
+ 'DistrictHeating' => 'District Heating',
110
+ 'Water' => 'Water'
111
+ }
110
112
 
111
113
  return fuel_types
112
114
  end
113
115
 
114
116
  # define enduses
115
117
  def end_uses
116
- end_uses = [
117
- 'Heating',
118
- 'Cooling',
119
- 'InteriorLights',
120
- 'ExteriorLights',
121
- 'InteriorEquipment',
122
- 'ExteriorEquipment',
123
- 'Fans',
124
- 'Pumps',
125
- 'HeatRejection',
126
- 'Humidifier',
127
- 'HeatRecovery',
128
- 'WaterSystems',
129
- 'Refrigeration',
130
- 'Generators',
131
- 'Facility'
132
- ]
118
+ end_uses = {
119
+ 'Heating' => 'Heating',
120
+ 'Cooling' => 'Cooling',
121
+ 'InteriorLights' => 'Interior Lighting',
122
+ 'ExteriorLights' => 'Exterior Lighting',
123
+ 'InteriorEquipment' => 'Interior Equipment',
124
+ 'ExteriorEquipment' => 'Exterior Equipment',
125
+ 'Fans' => 'Fans',
126
+ 'Pumps' => 'Pumps',
127
+ 'HeatRejection' => 'Heat Rejection',
128
+ 'Humidifier' => 'Humidification',
129
+ 'HeatRecovery' => 'Heat Recovery',
130
+ 'WaterSystems' => 'Water Systems',
131
+ 'Refrigeration' => 'Refrigeration',
132
+ 'Generators' => 'Generators',
133
+ 'Facility' => 'Facility'
134
+ }
133
135
 
134
136
  return end_uses
135
137
  end
@@ -163,7 +165,9 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
163
165
 
164
166
  # Request the output for each end use/fuel type combination
165
167
  end_uses.each do |end_use|
168
+ end_use, = end_use
166
169
  fuel_types.each do |fuel_type|
170
+ fuel_type, = fuel_type
167
171
  variable_name = if end_use == 'Facility'
168
172
  "#{fuel_type}:#{end_use}"
169
173
  else
@@ -173,6 +177,24 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
173
177
  end
174
178
  end
175
179
 
180
+ # OtherFuels
181
+ other_fuels = ['FuelOil#1', 'Diesel', 'Gasoline', 'Coal', 'Steam']
182
+ other_fuel_uses = ['HeatRejection', 'Heating', 'WaterSystems', 'InteriorEquipment']
183
+ custom_meter_facility = 'Meter:Custom,OtherFuels:Facility,OtherFuel1'
184
+ other_fuel_uses.each do |end_use|
185
+ custom_meter = "Meter:Custom,#{end_use}:OtherFuels,OtherFuel1"
186
+ other_fuels.each do |other_fuel|
187
+ result << OpenStudio::IdfObject.load("Output:Meter,#{end_use}:#{other_fuel},#{reporting_frequency};").get
188
+ custom_meter_facility += ",,#{end_use}:#{other_fuel}"
189
+ custom_meter += ",,#{end_use}:#{other_fuel}"
190
+ end
191
+ custom_meter += ';'
192
+ result << OpenStudio::IdfObject.load(custom_meter).get
193
+ result << OpenStudio::IdfObject.load("Output:Meter,#{end_use}:OtherFuels,#{reporting_frequency};").get
194
+ end
195
+ result << OpenStudio::IdfObject.load("#{custom_meter_facility};").get
196
+ result << OpenStudio::IdfObject.load("Output:Meter,OtherFuels:Facility,#{reporting_frequency};").get
197
+
176
198
  # Request the output for each end use/fuel type combination
177
199
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Electricity:Facility,#{reporting_frequency};").get
178
200
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,ElectricityProduced:Facility,#{reporting_frequency};").get
@@ -228,11 +250,14 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
228
250
  end
229
251
  end
230
252
 
231
- val
253
+ return val
232
254
  end
233
255
 
234
256
  # unit conversion method
235
257
  def convert_units(value, from_units, to_units)
258
+ if value.nil?
259
+ return nil
260
+ end
236
261
  # apply unit conversion
237
262
  value_converted = OpenStudio.convert(value, from_units, to_units)
238
263
  if value_converted.is_initialized
@@ -333,14 +358,14 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
333
358
  # get longitude from feature_location
334
359
  longitude = (feature_location.split(',')[1].delete! '[]').to_f
335
360
  # latitude
336
- feature_report.location.latitude = latitude
361
+ feature_report.location.latitude_deg = latitude
337
362
  # longitude
338
- feature_report.location.longitude = longitude
363
+ feature_report.location.longitude_deg = longitude
339
364
  end
340
365
 
341
366
  # surface_elevation
342
367
  elev = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='General' AND RowName='Elevation' AND ColumnName='Value'")
343
- feature_report.location.surface_elevation = elev
368
+ feature_report.location.surface_elevation_ft = elev
344
369
 
345
370
  ##########################################################################
346
371
  ##
@@ -350,18 +375,18 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
350
375
 
351
376
  # floor_area
352
377
  floor_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Total Building Area' AND ColumnName='Area'")
353
- feature_report.program.floor_area = convert_units(floor_area, 'm^2', 'ft^2')
378
+ feature_report.program.floor_area_sqft = convert_units(floor_area, 'm^2', 'ft^2')
354
379
 
355
380
  # conditioned_area
356
381
  conditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Net Conditioned Building Area' AND ColumnName='Area'")
357
- feature_report.program.conditioned_area = convert_units(conditioned_area, 'm^2', 'ft^2')
382
+ feature_report.program.conditioned_area_sqft = convert_units(conditioned_area, 'm^2', 'ft^2')
358
383
 
359
384
  # unconditioned_area
360
385
  unconditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Unconditioned Building Area' AND ColumnName='Area'")
361
- feature_report.program.unconditioned_area = convert_units(unconditioned_area, 'm^2', 'ft^2')
386
+ feature_report.program.unconditioned_area_sqft = convert_units(unconditioned_area, 'm^2', 'ft^2')
362
387
 
363
388
  # footprint_area
364
- feature_report.program.footprint_area = convert_units(floor_area, 'm^2', 'ft^2')
389
+ feature_report.program.footprint_area_sqft = convert_units(floor_area, 'm^2', 'ft^2')
365
390
 
366
391
  # maximum_number_of_stories
367
392
  number_of_stories = building.standardsNumberOfStories.get if building.standardsNumberOfStories.is_initialized
@@ -371,7 +396,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
371
396
  # maximum_roof_height
372
397
  floor_to_floor_height = building.nominalFloortoFloorHeight.to_f
373
398
  maximum_roof_height = number_of_stories * floor_to_floor_height
374
- feature_report.program.maximum_roof_height = maximum_roof_height
399
+ feature_report.program.maximum_roof_height_ft = maximum_roof_height
375
400
 
376
401
  # maximum_number_of_stories_above_ground
377
402
  number_of_stories_above_ground = building.standardsNumberOfAboveGroundStories.get if building.standardsNumberOfAboveGroundStories.is_initialized
@@ -432,36 +457,36 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
432
457
  ## window_area
433
458
  # north_window_area
434
459
  north_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='North (315 to 45 deg)'").to_f
435
- feature_report.program.window_area[:north_window_area] = convert_units(north_window_area, 'm^2', 'ft^2')
460
+ feature_report.program.window_area_sqft[:north_window_area_sqft] = convert_units(north_window_area, 'm^2', 'ft^2')
436
461
  # south_window_area
437
462
  south_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='South (135 to 225 deg)'").to_f
438
- feature_report.program.window_area[:south_window_area] = convert_units(south_window_area, 'm^2', 'ft^2')
463
+ feature_report.program.window_area_sqft[:south_window_area_sqft] = convert_units(south_window_area, 'm^2', 'ft^2')
439
464
  # east_window_area
440
465
  east_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='East (45 to 135 deg)'").to_f
441
- feature_report.program.window_area[:east_window_area] = convert_units(east_window_area, 'm^2', 'ft^2')
466
+ feature_report.program.window_area_sqft[:east_window_area_sqft] = convert_units(east_window_area, 'm^2', 'ft^2')
442
467
  # west_window_area
443
468
  west_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='West (225 to 315 deg)'").to_f
444
- feature_report.program.window_area[:west_window_area] = convert_units(west_window_area, 'm^2', 'ft^2')
469
+ feature_report.program.window_area_sqft[:west_window_area_sqft] = convert_units(west_window_area, 'm^2', 'ft^2')
445
470
  # total_window_area
446
471
  total_window_area = north_window_area + south_window_area + east_window_area + west_window_area
447
- feature_report.program.window_area[:total_window_area] = convert_units(total_window_area, 'm^2', 'ft^2')
472
+ feature_report.program.window_area_sqft[:total_window_area_sqft] = convert_units(total_window_area, 'm^2', 'ft^2')
448
473
 
449
474
  ## wall_area
450
475
  # north_wall_area
451
476
  north_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='North (315 to 45 deg)'").to_f
452
- feature_report.program.wall_area[:north_wall_area] = convert_units(north_wall_area, 'm^2', 'ft^2')
477
+ feature_report.program.wall_area_sqft[:north_wall_area_sqft] = convert_units(north_wall_area, 'm^2', 'ft^2')
453
478
  # south_wall_area
454
479
  south_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='South (135 to 225 deg)'").to_f
455
- feature_report.program.wall_area[:south_wall_area] = convert_units(south_wall_area, 'm^2', 'ft^2')
480
+ feature_report.program.wall_area_sqft[:south_wall_area_sqft] = convert_units(south_wall_area, 'm^2', 'ft^2')
456
481
  # east_wall_area
457
482
  east_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='East (45 to 135 deg)'").to_f
458
- feature_report.program.wall_area[:east_wall_area] = convert_units(east_wall_area, 'm^2', 'ft^2')
483
+ feature_report.program.wall_area_sqft[:east_wall_area_sqft] = convert_units(east_wall_area, 'm^2', 'ft^2')
459
484
  # west_wall_area
460
485
  west_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='West (225 to 315 deg)'").to_f
461
- feature_report.program.wall_area[:west_wall_area] = convert_units(west_wall_area, 'm^2', 'ft^2')
486
+ feature_report.program.wall_area_sqft[:west_wall_area_sqft] = convert_units(west_wall_area, 'm^2', 'ft^2')
462
487
  # total_wall_area
463
488
  total_wall_area = north_wall_area + south_wall_area + east_wall_area + west_wall_area
464
- feature_report.program.wall_area[:total_wall_area] = convert_units(total_wall_area, 'm^2', 'ft^2')
489
+ feature_report.program.wall_area_sqft[:total_wall_area_sqft] = convert_units(total_wall_area, 'm^2', 'ft^2')
465
490
 
466
491
  # total_roof_area
467
492
  total_roof_area = 0.0
@@ -470,12 +495,12 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
470
495
  total_roof_area += surface.netArea
471
496
  end
472
497
  end
473
- feature_report.program.roof_area[:total_roof_area] = convert_units(total_roof_area, 'm^2', 'ft^2')
498
+ feature_report.program.roof_area_sqft[:total_roof_area_sqft] = convert_units(total_roof_area, 'm^2', 'ft^2')
474
499
 
475
500
  # orientation
476
501
  # RK: a more robust method should be implemented to find orientation(finding main axis of the building using aspect ratio)
477
502
  building_rotation = model.getBuilding.northAxis
478
- feature_report.program.orientation = building_rotation
503
+ feature_report.program.orientation_deg = building_rotation
479
504
 
480
505
  # aspect_ratio
481
506
  north_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='North (315 to 45 deg)'")
@@ -486,7 +511,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
486
511
 
487
512
  # total_construction_cost
488
513
  total_construction_cost = sql_query(runner, sql_file, 'Life-Cycle Cost Report', "TableName='Present Value for Recurring, Nonrecurring and Energy Costs (Before Tax)' AND RowName='LCC_MAT - BUILDING - LIFE CYCLE COSTS' AND ColumnName='Cost'")
489
- feature_report.program.total_construction_cost = total_construction_cost
514
+ feature_report.program.total_construction_cost_dollar = total_construction_cost
490
515
 
491
516
  # packaged thermal storage capacities by cooling coil
492
517
  ptes_keys = sql_file.availableKeyValues('RUN Period 1', 'Zone Timestep', 'Cooling Coil Ice Thermal Storage End Fraction')
@@ -504,7 +529,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
504
529
  runner.registerWarning('Query ptes_size.get failed')
505
530
  end
506
531
  end
507
- feature_report.thermal_storage.ptes_size = ptes_size
532
+ feature_report.thermal_storage.ptes_size_kwh = ptes_size
508
533
 
509
534
  # get the central tank thermal storage capacity
510
535
  its_size = nil
@@ -519,7 +544,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
519
544
  runner.registerWarning('Query its_size.get failed')
520
545
  end
521
546
  end
522
- feature_report.thermal_storage.its_size = its_size
547
+ feature_report.thermal_storage.its_size_kwh = its_size
523
548
 
524
549
  ############################################################################
525
550
  ##
@@ -550,78 +575,132 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
550
575
 
551
576
  # total_site_energy
552
577
  total_site_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Total Site Energy' AND ColumnName='Total Energy'")
553
- feature_report.reporting_periods[0].total_site_energy = convert_units(total_site_energy, 'GJ', 'kBtu')
578
+ feature_report.reporting_periods[0].total_site_energy_kwh = convert_units(total_site_energy, 'GJ', 'kWh')
554
579
 
555
580
  # total_source_energy
556
581
  total_source_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Total Source Energy' AND ColumnName='Total Energy'")
557
- feature_report.reporting_periods[0].total_source_energy = convert_units(total_source_energy, 'GJ', 'kBtu')
582
+ feature_report.reporting_periods[0].total_source_energy_kwh = convert_units(total_source_energy, 'GJ', 'kWh')
558
583
 
559
584
  # net_site_energy
560
585
  net_site_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Net Site Energy' AND ColumnName='Total Energy'")
561
- feature_report.reporting_periods[0].net_site_energy = convert_units(net_site_energy, 'GJ', 'kBtu')
586
+ feature_report.reporting_periods[0].net_site_energy_kwh = convert_units(net_site_energy, 'GJ', 'kWh')
562
587
 
563
588
  # net_source_energy
564
589
  net_source_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Net Source Energy' AND ColumnName='Total Energy'")
565
- feature_report.reporting_periods[0].net_source_energy = convert_units(net_source_energy, 'GJ', 'kBtu')
590
+ feature_report.reporting_periods[0].net_source_energy_kwh = convert_units(net_source_energy, 'GJ', 'kWh')
566
591
 
567
592
  # electricity
568
593
  electricity = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Electricity'")
569
- feature_report.reporting_periods[0].electricity = convert_units(electricity, 'GJ', 'kBtu')
594
+ feature_report.reporting_periods[0].electricity_kwh = convert_units(electricity, 'GJ', 'kWh')
570
595
 
571
596
  # natural_gas
572
597
  natural_gas = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Natural Gas'")
573
- feature_report.reporting_periods[0].natural_gas = convert_units(natural_gas, 'GJ', 'kBtu')
598
+ feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
599
+
600
+ # propane
601
+ propane = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='Propane:Facility' AND ColumnName='Annual Value'")
602
+ feature_report.reporting_periods[0].propane_kwh = 0.0
603
+ feature_report.reporting_periods[0].propane_kwh = convert_units(propane, 'GJ', 'kWh') unless propane.nil?
574
604
 
575
- # additional_fuel
605
+ # fuel_oil
606
+ fuel_oil = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='FuelOil#2:Facility' AND ColumnName='Annual Value'")
607
+ feature_report.reporting_periods[0].fuel_oil_kwh = 0.0
608
+ feature_report.reporting_periods[0].fuel_oil_kwh = convert_units(fuel_oil, 'GJ', 'kWh') unless fuel_oil.nil?
609
+
610
+ # other_fuels
576
611
  additional_fuel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Additional Fuel'")
577
- feature_report.reporting_periods[0].additional_fuel = convert_units(additional_fuel, 'GJ', 'kBtu')
612
+ # ensure additional fuel is not nil
613
+ feature_report.reporting_periods[0].other_fuels_kwh = 0.0
614
+ feature_report.reporting_periods[0].other_fuels_kwh = convert_units(additional_fuel, 'GJ', 'kWh') unless additional_fuel.nil?
615
+ feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].propane_kwh
616
+ feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].fuel_oil_kwh
578
617
 
579
618
  # district_cooling
580
619
  district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
581
- feature_report.reporting_periods[0].district_cooling = convert_units(district_cooling, 'GJ', 'kBtu')
620
+ feature_report.reporting_periods[0].district_cooling_kwh = convert_units(district_cooling, 'GJ', 'kWh')
621
+ building_types.each do |i|
622
+ feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
623
+ end
582
624
 
583
625
  # district_heating
584
626
  district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
585
- feature_report.reporting_periods[0].district_heating = convert_units(district_heating, 'GJ', 'kBtu')
627
+ feature_report.reporting_periods[0].district_heating_kwh = convert_units(district_heating, 'GJ', 'kWh')
628
+ building_types.each do |i|
629
+ feature_report.reporting_periods[0].district_heating_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
630
+ end
586
631
 
587
632
  # water
588
633
  water = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Water'")
589
634
  # feature_report.reporting_periods[0].water = convert_units(water, 'm3', 'ft3')
590
- feature_report.reporting_periods[0].water = water
635
+ feature_report.reporting_periods[0].water_qbft = water
591
636
 
592
637
  # electricity_produced
593
638
  electricity_produced = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Total On-Site and Utility Electric Sources' AND ColumnName='Electricity'")
594
- feature_report.reporting_periods[0].electricity_produced = convert_units(electricity_produced, 'GJ', 'kBtu')
639
+ feature_report.reporting_periods[0].electricity_produced_kwh = convert_units(electricity_produced, 'GJ', 'kWh')
595
640
 
596
641
  ## end_uses
597
642
 
598
643
  # get fuel type as listed in the sql file
599
- fuel_type = ['Electricity', 'Natural Gas', 'Additional Fuel', 'District Cooling', 'District Heating', 'Water']
644
+ fueltypes = fuel_types.values
645
+ fueltypes.delete('Propane')
646
+ fueltypes.delete('Fuel Oil #2')
600
647
 
601
648
  # get enduses as listed in the sql file
602
- enduses = ['Heating', 'Cooling', 'Interior Lighting', 'Exterior Lighting', 'Interior Equipment', 'Exterior Equipment', 'Fans', 'Pumps',
603
- 'Heat Rejection', 'Humidification', 'Heat Recovery', 'Water Systems', 'Refrigeration', 'Generators']
649
+ enduses = end_uses.values
650
+ enduses.delete('Facility')
651
+
652
+ # propane / fuel_oil
653
+ ['Propane', 'Fuel Oil #2'].each do |ft|
654
+ end_uses.keys.each do |eu|
655
+ next if eu == 'Facility'
656
+
657
+ sql_r = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='#{eu}:#{ft.tr(' ', '')}' AND ColumnName='Annual Value'")
658
+
659
+ # report each query in its corresponding feature report obeject
660
+ x = ft.tr(' ', '_').downcase
661
+ x = x.gsub('_#2', '')
662
+ x_u = x + '_kwh'
663
+ m = feature_report.reporting_periods[0].end_uses.send(x_u)
664
+
665
+ y = end_uses[eu].tr(' ', '_').downcase
666
+ if sql_r.nil?
667
+ sql_r = 0.0
668
+ end
669
+ m.send("#{y}=", convert_units(sql_r, 'GJ', 'kWh'))
670
+ end
671
+ end
604
672
 
605
673
  # loop through fuel types and enduses to fill in sql_query method
606
- fuel_type.each do |ft|
674
+ fueltypes.each do |ft|
607
675
  enduses.each do |eu|
608
676
  sql_r = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")
609
677
 
610
678
  # report each query in its corresponding feature report obeject
611
- if ft.include? ' '
612
- x = ft.tr(' ', '_').downcase
613
- m = feature_report.reporting_periods[0].end_uses.send(x)
679
+ x = ft.tr(' ', '_').downcase
680
+ if x.include? 'water'
681
+ x_u = x + '_qbft'
614
682
  else
615
- m = feature_report.reporting_periods[0].end_uses.send(ft.downcase)
616
-
683
+ x_u = x + '_kwh'
617
684
  end
685
+ if x_u == 'additional_fuel_kwh'
686
+ x_u = 'other_fuels_kwh'
687
+ end
688
+ m = feature_report.reporting_periods[0].end_uses.send(x_u)
618
689
 
619
- if eu.include? ' '
620
- y = eu.tr(' ', '_').downcase
621
- m.send("#{y}=", convert_units(sql_r, 'GJ', 'kBtu'))
622
- else
623
- m.send("#{eu.downcase}=", convert_units(sql_r, 'GJ', 'kBtu'))
690
+ y = eu.tr(' ', '_').downcase
691
+ # ensure not nil so the equations below don't error out
692
+ if sql_r.nil?
693
+ sql_r = 0.0
694
+ end
695
+ sql_r = convert_units(sql_r, 'GJ', 'kWh')
696
+ if x_u == 'other_fuels_kwh'
697
+ sql_r -= feature_report.reporting_periods[0].end_uses.propane_kwh.send(y)
698
+ sql_r -= feature_report.reporting_periods[0].end_uses.fuel_oil_kwh.send(y)
624
699
  end
700
+ building_types.each do |i|
701
+ sql_r = 0.0 if i[:building_type].include?('Single-Family Detached') && x_u.include?('district')
702
+ end
703
+ m.send("#{y}=", sql_r)
625
704
  end
626
705
  end
627
706
 
@@ -629,20 +708,20 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
629
708
  ## electricity_produced
630
709
  # photovoltaic
631
710
  photovoltaic_power = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Photovoltaic Power' AND ColumnName='Electricity'")
632
- feature_report.reporting_periods[0].energy_production[:electricity_produced][:photovoltaic] = convert_units(photovoltaic_power, 'GJ', 'kBtu')
711
+ feature_report.reporting_periods[0].energy_production_kwh[:electricity_produced][:photovoltaic] = convert_units(photovoltaic_power, 'GJ', 'kWh')
633
712
 
634
713
  ## Total utility cost
635
714
  total_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Total'")
636
- feature_report.reporting_periods[0].total_utility_cost = total_utility_cost
715
+ feature_report.reporting_periods[0].total_utility_cost_dollar = total_utility_cost
637
716
 
638
717
  ## Utility Costs
639
718
  # electricity utility cost
640
719
  elec_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Electric'")
641
- feature_report.reporting_periods[0].utility_costs[0][:fuel_type] = 'Electricity'
642
- feature_report.reporting_periods[0].utility_costs[0][:total_cost] = elec_utility_cost
720
+ feature_report.reporting_periods[0].utility_costs_dollar[0][:fuel_type] = 'Electricity'
721
+ feature_report.reporting_periods[0].utility_costs_dollar[0][:total_cost] = elec_utility_cost
643
722
  # gas utility cost
644
723
  gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
645
- feature_report.reporting_periods[0].utility_costs << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
724
+ feature_report.reporting_periods[0].utility_costs_dollar << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
646
725
 
647
726
  ## comfort_result
648
727
  # time_setpoint_not_met_during_occupied_cooling
@@ -680,6 +759,9 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
680
759
  'Electricity:Facility',
681
760
  'ElectricityProduced:Facility',
682
761
  'Gas:Facility',
762
+ 'Propane:Facility',
763
+ 'FuelOil#2:Facility',
764
+ 'OtherFuels:Facility',
683
765
  'Cooling:Electricity',
684
766
  'Heating:Electricity',
685
767
  'InteriorLights:Electricity',
@@ -693,6 +775,18 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
693
775
  'Heating:Gas',
694
776
  'WaterSystems:Gas',
695
777
  'InteriorEquipment:Gas',
778
+ 'HeatRejection:Propane',
779
+ 'Heating:Propane',
780
+ 'WaterSystems:Propane',
781
+ 'InteriorEquipment:Propane',
782
+ 'HeatRejection:FuelOil#2',
783
+ 'Heating:FuelOil#2',
784
+ 'WaterSystems:FuelOil#2',
785
+ 'InteriorEquipment:FuelOil#2',
786
+ 'HeatRejection:OtherFuels',
787
+ 'Heating:OtherFuels',
788
+ 'WaterSystems:OtherFuels',
789
+ 'InteriorEquipment:OtherFuels',
696
790
  'DistrictCooling:Facility',
697
791
  'DistrictHeating:Facility',
698
792
  'District Cooling Chilled Water Rate',
@@ -757,7 +851,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
757
851
  runner.registerInfo("TIMESERIES: #{timeseries_name}")
758
852
 
759
853
  # get all the key values that this timeseries can be reported for (e.g. if PMV is requested for each zone)
760
- key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name)
854
+ if timeseries_name.include?('OtherFuels')
855
+ key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name.upcase)
856
+ else
857
+ key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name)
858
+ end
761
859
  runner.registerInfo("KEY VALUES: #{key_values}")
762
860
  if key_values.empty?
763
861
  key_values = ['']
@@ -801,7 +899,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
801
899
  # final_timeseries_names << new_timeseries_name
802
900
 
803
901
  # get the actual timeseries
804
- ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name, key_value)
902
+ if timeseries_name.include?('OtherFuels')
903
+ ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name.upcase, key_value)
904
+ else
905
+ ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name, key_value)
906
+ end
805
907
 
806
908
  if n.nil?
807
909
  # first timeseries should always be set
@@ -816,10 +918,15 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
816
918
  values[key_cnt] = Array.new(n, 0)
817
919
  end
818
920
 
921
+ # residential considerations
922
+ building_types.each do |i|
923
+ values[key_cnt] = Array.new(n, 0) if ['DistrictCooling:Facility', 'DistrictHeating:Facility'].include?(timeseries_name) && i[:building_type].include?('Single-Family Detached')
924
+ end
925
+
819
926
  # unit conversion
820
927
  old_unit = ts.get.units if ts.is_initialized
821
928
 
822
- if timeseries_name.include? 'Gas'
929
+ if timeseries_name.include?('Gas') || timeseries_name.include?('Propane') || timeseries_name.include?('FuelOil#2') || timeseries_name.include?('OtherFuels')
823
930
  new_unit = 'kBtu'
824
931
  else
825
932
  new_unit = case old_unit.to_s