urbanopt-reporting 0.2.1 → 0.3.4

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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +40 -1
  3. data/LICENSE.md +1 -1
  4. data/doc_templates/LICENSE.md +1 -1
  5. data/doc_templates/copyright_erb.txt +1 -1
  6. data/doc_templates/copyright_js.txt +1 -1
  7. data/doc_templates/copyright_ruby.txt +1 -1
  8. data/docs/package-lock.json +3 -3
  9. data/docs/package.json +1 -1
  10. data/lib/measures/default_feature_reports/LICENSE.md +1 -1
  11. data/lib/measures/default_feature_reports/measure.rb +193 -59
  12. data/lib/measures/default_feature_reports/measure.xml +11 -11
  13. data/lib/measures/export_modelica_loads/LICENSE.md +27 -0
  14. data/lib/measures/export_modelica_loads/README.md +26 -0
  15. data/lib/measures/export_modelica_loads/README.md.erb +42 -0
  16. data/lib/measures/export_modelica_loads/docs/.gitkeep +0 -0
  17. data/lib/measures/export_modelica_loads/measure.rb +373 -0
  18. data/lib/measures/export_modelica_loads/measure.xml +92 -0
  19. data/lib/measures/export_modelica_loads/resources/report.html.in +13 -0
  20. data/lib/measures/export_time_series_modelica/LICENSE.md +1 -0
  21. data/lib/measures/export_time_series_modelica/README.md +59 -0
  22. data/lib/measures/export_time_series_modelica/README.md.erb +42 -0
  23. data/lib/measures/export_time_series_modelica/docs/.gitkeep +0 -0
  24. data/lib/measures/export_time_series_modelica/measure.rb +429 -0
  25. data/lib/measures/export_time_series_modelica/measure.xml +147 -0
  26. data/lib/measures/export_time_series_modelica/resources/os_lib_helper_methods.rb +399 -0
  27. data/lib/measures/export_time_series_modelica/resources/report.html.in +13 -0
  28. data/lib/urbanopt/reporting/default_reports/end_uses.rb +23 -9
  29. data/lib/urbanopt/reporting/default_reports/feature_report.rb +62 -5
  30. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +42 -22
  31. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +7 -4
  32. data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +15 -0
  33. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +33 -5
  34. data/lib/urbanopt/reporting/version.rb +1 -1
  35. data/urbanopt-reporting-gem.gemspec +1 -1
  36. metadata +19 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73d4a00d402cdde91643c03b38449beb6978e5e6cb1af0b9102d607a3c865548
4
- data.tar.gz: 8dd9ba4afbd16ba9a08f32edb24e0939cb9689b55683cd50c18a1e002f7fb4fd
3
+ metadata.gz: 75187e938a1cbfabd1d74eba912af03fcd2aade54955a490d68ea1b97b229dd2
4
+ data.tar.gz: 25b56a46e4569a71a7c01964bf64f2a14d8c30fdc9f6f5167fd61b40f272eb52
5
5
  SHA512:
6
- metadata.gz: 75c674f97c37f9cdb64ab7c0e523691aae8027dbf74a25be38634924676a526de207306bd0ac05de533e24071af73e98a898058f120748b0c100fcc4f2a3b927
7
- data.tar.gz: 44eed7300f9b94e85b431bf7fcee1d47e5a2480f0801036b9839d3b8ea9f057c42e498cd2ef99863abf30375db9be5f2f2acfdc0d2b6a4cd954c5a4759509a46
6
+ metadata.gz: 5a5f20c29cc1eec6aafeece4479a52c4c5a6a0ecfb0374a0b8f243551f9a7d49ecfbcf25b233ce7e19441551adcd87c5eb668ad509d4c87b0681ea1a187da6b2
7
+ data.tar.gz: bccc2ad11e97d3330f2706cb9a7d32c5c0209130af88738854e6d56fb6d34b5ccfcc8b51b42633d3f359bf4c03c34d4888108528bd38c558c96ec06569c92e9d
@@ -1,5 +1,44 @@
1
1
  # URBANopt Reporting Gem
2
2
 
3
+ ## Version 0.3.4
4
+
5
+ Date Range: 01/14/21 - 01/15/21
6
+
7
+ - Fixed [#53]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/53 ), Make subfolders in feature saving if necessary
8
+ - Fixed [#55]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/55 ), Fix new measures
9
+
10
+ ## Version 0.3.3
11
+
12
+ Date Range: 12/09/20 - 01/13/21
13
+
14
+ - Fixed [#36]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/36 ), Add reporting measure for district heating/cooling system mass flow rates
15
+ - Fixed [#37]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/37 ), Add EUI to default report
16
+ - Fixed [#38]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/38 ), Add better error handling around convert_units
17
+ - Fixed [#43]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/43 ), Add available_roof_area calculation
18
+ - Fixed [#44]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/44 ), Fix coordinates order
19
+
20
+ ## Version 0.3.2
21
+
22
+ Date Range: 12/07/20 - 12/08/20
23
+
24
+ - Fixed [#27]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/27 ), reporting measure fails when there are no additional fuels in the model
25
+ - Fixed [#29]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/29 ), restore save_feature_report function for backward compatibility
26
+ - Fixed [#32]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/32 ), bump extension-gem dependency
27
+
28
+ ## Version 0.3.1
29
+
30
+ Date Range: 11/26/2020 - 12/07/2020
31
+
32
+ - Fixed [#19]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/19 ), check for nil values to avoid crashing unit conversion
33
+ - Fixed [#24]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/24 ), Support reporting of other fuels
34
+ - Fixed [#28]( https://github.com/urbanopt/urbanopt-reporting-gem/pull/28 ), fix for other_fuels being nil and restore save_feature_report function
35
+
36
+ ## Version 0.3.0
37
+
38
+ Date Range: 11/12/2020 - 11/25/2020
39
+
40
+ - Updating dependencies to support OpenStudio 3.1.0
41
+
3
42
  ## Version 0.2.1
4
43
 
5
44
  Date Range: 09/22/2020 - 11/12/2020
@@ -29,4 +68,4 @@ Date Range: 08/27/2020 - 09/21/2020
29
68
 
30
69
  08/17/2020
31
70
 
32
- Initial release of the urbanopt-reporting gem.
71
+ Initial release of the urbanopt-reporting gem.
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- URBANopt<sup>&trade;</sup>, 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,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,6 +1,6 @@
1
1
  <%
2
2
  # *********************************************************************************
3
- # URBANopt™, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
3
+ # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
4
4
  # contributors. All rights reserved.
5
5
  #
6
6
  # Redistribution and use in source and binary forms, with or without modification,
@@ -1,4 +1,4 @@
1
1
  /* @preserve
2
- * URBANopt™, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
2
+ * URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
3
3
  * Use of this source code is governed by the BSD 3-Clause license.
4
4
  */
@@ -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,
@@ -4814,9 +4814,9 @@
4814
4814
  "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ=="
4815
4815
  },
4816
4816
  "highlight.js": {
4817
- "version": "10.3.1",
4818
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.3.1.tgz",
4819
- "integrity": "sha512-jeW8rdPdhshYKObedYg5XGbpVgb1/DT4AHvDFXhkU7UnGSIjy9kkJ7zHG7qplhFHMitTSzh5/iClKQk3Kb2RFQ=="
4817
+ "version": "10.4.1",
4818
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz",
4819
+ "integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg=="
4820
4820
  },
4821
4821
  "hmac-drbg": {
4822
4822
  "version": "1.0.1",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "author": "NREL",
12
12
  "dependencies": {
13
- "highlight.js": "^10.3.1",
13
+ "highlight.js": "^10.4.1",
14
14
  "json-schema-ref-parser": "^9.0.6",
15
15
  "json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
16
16
  "vuepress": "^1.7.1",
@@ -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,19 @@ 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
261
+ if from_units.nil? || to_units.nil?
262
+ @runner.registerError("Cannot convert units...from_units: #{from_units} or to_units: #{to_units} left blank.")
263
+ return nil
264
+ end
265
+
236
266
  # apply unit conversion
237
267
  value_converted = OpenStudio.convert(value, from_units, to_units)
238
268
  if value_converted.is_initialized
@@ -328,10 +358,10 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
328
358
  ##
329
359
 
330
360
  if feature_location.include? '['
331
- # get latitude from feature_location
332
- latitude = (feature_location.split(',')[0].delete! '[]').to_f
333
361
  # get longitude from feature_location
334
- longitude = (feature_location.split(',')[1].delete! '[]').to_f
362
+ longitude = (feature_location.split(',')[0].delete! '[]').to_f
363
+ # get latitude from feature_location
364
+ latitude = (feature_location.split(',')[1].delete! '[]').to_f
335
365
  # latitude
336
366
  feature_report.location.latitude_deg = latitude
337
367
  # longitude
@@ -470,7 +500,22 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
470
500
  total_roof_area += surface.netArea
471
501
  end
472
502
  end
473
- feature_report.program.roof_area_sqft[:total_roof_area_sqft] = convert_units(total_roof_area, 'm^2', 'ft^2')
503
+
504
+ total_roof_area_sqft = convert_units(total_roof_area, 'm^2', 'ft^2')
505
+ feature_report.program.roof_area_sqft[:total_roof_area_sqft] = total_roof_area_sqft
506
+
507
+ # available_roof_area_sqft
508
+ # RK: a more robust method should be implemented to find the available_roof_area
509
+ # assign available roof area to be a percentage of the total roof area
510
+
511
+ if building_types[0][:building_type].include? 'Single-Family Detached'
512
+ feature_report.program.roof_area_sqft[:available_roof_area_sqft] = 0.45 * total_roof_area_sqft
513
+ else
514
+ feature_report.program.roof_area_sqft[:available_roof_area_sqft] = 0.75 * total_roof_area_sqft
515
+ end
516
+
517
+ # RK: Temporary solution: assign available roof area to be equal to total roof area
518
+ # feature_report.program.roof_area_sqft[:available_roof_area_sqft] = total_roof_area_sqft
474
519
 
475
520
  # orientation
476
521
  # RK: a more robust method should be implemented to find orientation(finding main axis of the building using aspect ratio)
@@ -556,6 +601,22 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
556
601
  total_source_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Total Source Energy' AND ColumnName='Total Energy'")
557
602
  feature_report.reporting_periods[0].total_source_energy_kwh = convert_units(total_source_energy, 'GJ', 'kWh')
558
603
 
604
+ # EUI is only valid with a full year of energy data
605
+ if begin_month == 1 && begin_day_of_month == 1 && end_month == 12 && end_day_of_month == 31
606
+ # calculate site EUI
607
+ site_EUI_kwh_per_m2 = feature_report.reporting_periods[0].total_site_energy_kwh / floor_area
608
+ site_EUI_kbtu_per_ft2 = convert_units(total_site_energy, 'GJ', 'kBtu') / feature_report.program.floor_area_sqft
609
+ # add site EUI to feature report
610
+ feature_report.reporting_periods[0].site_EUI_kwh_per_m2 = site_EUI_kwh_per_m2
611
+ feature_report.reporting_periods[0].site_EUI_kbtu_per_ft2 = site_EUI_kbtu_per_ft2
612
+ # calculate source EUI
613
+ source_EUI_kwh_per_m2 = feature_report.reporting_periods[0].total_source_energy_kwh / floor_area
614
+ source_EUI_kbtu_per_ft2 = convert_units(total_source_energy, 'GJ', 'kBtu') / feature_report.program.floor_area_sqft
615
+ # add source EUI to feature report
616
+ feature_report.reporting_periods[0].source_EUI_kwh_per_m2 = source_EUI_kwh_per_m2
617
+ feature_report.reporting_periods[0].source_EUI_kbtu_per_ft2 = source_EUI_kbtu_per_ft2
618
+ end
619
+
559
620
  # net_site_energy
560
621
  net_site_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Net Site Energy' AND ColumnName='Total Energy'")
561
622
  feature_report.reporting_periods[0].net_site_energy_kwh = convert_units(net_site_energy, 'GJ', 'kWh')
@@ -572,17 +633,37 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
572
633
  natural_gas = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Natural Gas'")
573
634
  feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
574
635
 
575
- # additional_fuel
636
+ # propane
637
+ propane = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='Propane:Facility' AND ColumnName='Annual Value'")
638
+ feature_report.reporting_periods[0].propane_kwh = 0.0
639
+ feature_report.reporting_periods[0].propane_kwh = convert_units(propane, 'GJ', 'kWh') unless propane.nil?
640
+
641
+ # fuel_oil
642
+ fuel_oil = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='FuelOil#2:Facility' AND ColumnName='Annual Value'")
643
+ feature_report.reporting_periods[0].fuel_oil_kwh = 0.0
644
+ feature_report.reporting_periods[0].fuel_oil_kwh = convert_units(fuel_oil, 'GJ', 'kWh') unless fuel_oil.nil?
645
+
646
+ # other_fuels
576
647
  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_kwh = convert_units(additional_fuel, 'GJ', 'kWh')
648
+ # ensure additional fuel is not nil
649
+ feature_report.reporting_periods[0].other_fuels_kwh = 0.0
650
+ feature_report.reporting_periods[0].other_fuels_kwh = convert_units(additional_fuel, 'GJ', 'kWh') unless additional_fuel.nil?
651
+ feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].propane_kwh
652
+ feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].fuel_oil_kwh
578
653
 
579
654
  # district_cooling
580
655
  district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
581
656
  feature_report.reporting_periods[0].district_cooling_kwh = convert_units(district_cooling, 'GJ', 'kWh')
657
+ building_types.each do |i|
658
+ feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
659
+ end
582
660
 
583
661
  # district_heating
584
662
  district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
585
663
  feature_report.reporting_periods[0].district_heating_kwh = convert_units(district_heating, 'GJ', 'kWh')
664
+ building_types.each do |i|
665
+ feature_report.reporting_periods[0].district_heating_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
666
+ end
586
667
 
587
668
  # water
588
669
  water = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Water'")
@@ -596,41 +677,66 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
596
677
  ## end_uses
597
678
 
598
679
  # get fuel type as listed in the sql file
599
- fuel_type = ['Electricity', 'Natural Gas', 'Additional Fuel', 'District Cooling', 'District Heating', 'Water']
680
+ fueltypes = fuel_types.values
681
+ fueltypes.delete('Propane')
682
+ fueltypes.delete('Fuel Oil #2')
600
683
 
601
684
  # 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']
685
+ enduses = end_uses.values
686
+ enduses.delete('Facility')
687
+
688
+ # propane / fuel_oil
689
+ ['Propane', 'Fuel Oil #2'].each do |ft|
690
+ end_uses.keys.each do |eu|
691
+ next if eu == 'Facility'
692
+
693
+ sql_r = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='#{eu}:#{ft.tr(' ', '')}' AND ColumnName='Annual Value'")
694
+
695
+ # report each query in its corresponding feature report obeject
696
+ x = ft.tr(' ', '_').downcase
697
+ x = x.gsub('_#2', '')
698
+ x_u = x + '_kwh'
699
+ m = feature_report.reporting_periods[0].end_uses.send(x_u)
700
+
701
+ y = end_uses[eu].tr(' ', '_').downcase
702
+ if sql_r.nil?
703
+ sql_r = 0.0
704
+ end
705
+ m.send("#{y}=", convert_units(sql_r, 'GJ', 'kWh'))
706
+ end
707
+ end
604
708
 
605
709
  # loop through fuel types and enduses to fill in sql_query method
606
- fuel_type.each do |ft|
710
+ fueltypes.each do |ft|
607
711
  enduses.each do |eu|
608
712
  sql_r = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")
609
713
 
610
714
  # report each query in its corresponding feature report obeject
611
- if ft.include? ' '
612
- x = ft.tr(' ', '_').downcase
613
- if x.include? 'water'
614
- x_u = x + '_qbft'
615
- else
616
- x_u = x + '_kwh'
617
- end
618
- m = feature_report.reporting_periods[0].end_uses.send(x_u)
715
+ x = ft.tr(' ', '_').downcase
716
+ if x.include? 'water'
717
+ x_u = x + '_qbft'
619
718
  else
620
- if ft.downcase.include? 'water'
621
- ft_u = ft + '_qbft'
622
- else
623
- ft_u = ft + '_kwh'
624
- end
625
- m = feature_report.reporting_periods[0].end_uses.send(ft_u.downcase)
719
+ x_u = x + '_kwh'
626
720
  end
721
+ if x_u == 'additional_fuel_kwh'
722
+ x_u = 'other_fuels_kwh'
723
+ end
724
+ m = feature_report.reporting_periods[0].end_uses.send(x_u)
627
725
 
628
- if eu.include? ' '
629
- y = eu.tr(' ', '_').downcase
630
- m.send("#{y}=", convert_units(sql_r, 'GJ', 'kWh'))
631
- else
632
- m.send("#{eu.downcase}=", convert_units(sql_r, 'GJ', 'kWh'))
726
+ y = eu.tr(' ', '_').downcase
727
+ # ensure not nil so the equations below don't error out
728
+ if sql_r.nil?
729
+ sql_r = 0.0
730
+ end
731
+ sql_r = convert_units(sql_r, 'GJ', 'kWh')
732
+ if x_u == 'other_fuels_kwh'
733
+ sql_r -= feature_report.reporting_periods[0].end_uses.propane_kwh.send(y)
734
+ sql_r -= feature_report.reporting_periods[0].end_uses.fuel_oil_kwh.send(y)
633
735
  end
736
+ building_types.each do |i|
737
+ sql_r = 0.0 if i[:building_type].include?('Single-Family Detached') && x_u.include?('district')
738
+ end
739
+ m.send("#{y}=", sql_r)
634
740
  end
635
741
  end
636
742
 
@@ -689,6 +795,9 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
689
795
  'Electricity:Facility',
690
796
  'ElectricityProduced:Facility',
691
797
  'Gas:Facility',
798
+ 'Propane:Facility',
799
+ 'FuelOil#2:Facility',
800
+ 'OtherFuels:Facility',
692
801
  'Cooling:Electricity',
693
802
  'Heating:Electricity',
694
803
  'InteriorLights:Electricity',
@@ -702,6 +811,18 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
702
811
  'Heating:Gas',
703
812
  'WaterSystems:Gas',
704
813
  'InteriorEquipment:Gas',
814
+ 'HeatRejection:Propane',
815
+ 'Heating:Propane',
816
+ 'WaterSystems:Propane',
817
+ 'InteriorEquipment:Propane',
818
+ 'HeatRejection:FuelOil#2',
819
+ 'Heating:FuelOil#2',
820
+ 'WaterSystems:FuelOil#2',
821
+ 'InteriorEquipment:FuelOil#2',
822
+ 'HeatRejection:OtherFuels',
823
+ 'Heating:OtherFuels',
824
+ 'WaterSystems:OtherFuels',
825
+ 'InteriorEquipment:OtherFuels',
705
826
  'DistrictCooling:Facility',
706
827
  'DistrictHeating:Facility',
707
828
  'District Cooling Chilled Water Rate',
@@ -766,7 +887,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
766
887
  runner.registerInfo("TIMESERIES: #{timeseries_name}")
767
888
 
768
889
  # get all the key values that this timeseries can be reported for (e.g. if PMV is requested for each zone)
769
- key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name)
890
+ if timeseries_name.include?('OtherFuels')
891
+ key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name.upcase)
892
+ else
893
+ key_values = sql_file.availableKeyValues('RUN PERIOD 1', 'Zone Timestep', timeseries_name)
894
+ end
770
895
  runner.registerInfo("KEY VALUES: #{key_values}")
771
896
  if key_values.empty?
772
897
  key_values = ['']
@@ -810,7 +935,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
810
935
  # final_timeseries_names << new_timeseries_name
811
936
 
812
937
  # get the actual timeseries
813
- ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name, key_value)
938
+ if timeseries_name.include?('OtherFuels')
939
+ ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name.upcase, key_value)
940
+ else
941
+ ts = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, timeseries_name, key_value)
942
+ end
814
943
 
815
944
  if n.nil?
816
945
  # first timeseries should always be set
@@ -825,10 +954,15 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
825
954
  values[key_cnt] = Array.new(n, 0)
826
955
  end
827
956
 
957
+ # residential considerations
958
+ building_types.each do |i|
959
+ values[key_cnt] = Array.new(n, 0) if ['DistrictCooling:Facility', 'DistrictHeating:Facility'].include?(timeseries_name) && i[:building_type].include?('Single-Family Detached')
960
+ end
961
+
828
962
  # unit conversion
829
963
  old_unit = ts.get.units if ts.is_initialized
830
964
 
831
- if timeseries_name.include? 'Gas'
965
+ if timeseries_name.include?('Gas') || timeseries_name.include?('Propane') || timeseries_name.include?('FuelOil#2') || timeseries_name.include?('OtherFuels')
832
966
  new_unit = 'kBtu'
833
967
  else
834
968
  new_unit = case old_unit.to_s