urbanopt-reporting 0.3.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -3
  3. data/CHANGELOG.md +34 -0
  4. data/Rakefile +16 -6
  5. data/doc_templates/copyright_ruby.txt +17 -7
  6. data/lib/measures/default_feature_reports/measure.rb +120 -93
  7. data/lib/measures/default_feature_reports/measure.xml +11 -11
  8. data/lib/measures/export_modelica_loads/LICENSE.md +23 -23
  9. data/lib/measures/export_modelica_loads/measure.rb +48 -56
  10. data/lib/measures/export_modelica_loads/measure.xml +21 -21
  11. data/lib/measures/export_time_series_modelica/LICENSE.md +27 -1
  12. data/lib/measures/export_time_series_modelica/measure.rb +41 -35
  13. data/lib/measures/export_time_series_modelica/measure.xml +18 -18
  14. data/lib/measures/export_time_series_modelica/resources/os_lib_helper_methods.rb +39 -34
  15. data/lib/urbanopt/reporting.rb +16 -6
  16. data/lib/urbanopt/reporting/default_reports.rb +16 -6
  17. data/lib/urbanopt/reporting/default_reports/construction_cost.rb +16 -6
  18. data/lib/urbanopt/reporting/default_reports/date.rb +16 -6
  19. data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +16 -6
  20. data/lib/urbanopt/reporting/default_reports/end_use.rb +54 -23
  21. data/lib/urbanopt/reporting/default_reports/end_uses.rb +16 -6
  22. data/lib/urbanopt/reporting/default_reports/extension.rb +16 -6
  23. data/lib/urbanopt/reporting/default_reports/feature_report.rb +18 -6
  24. data/lib/urbanopt/reporting/default_reports/generator.rb +16 -6
  25. data/lib/urbanopt/reporting/default_reports/location.rb +16 -6
  26. data/lib/urbanopt/reporting/default_reports/logger.rb +16 -6
  27. data/lib/urbanopt/reporting/default_reports/power_distribution.rb +16 -6
  28. data/lib/urbanopt/reporting/default_reports/program.rb +17 -7
  29. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +16 -6
  30. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +25 -13
  31. data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +11 -10
  32. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +4 -1
  33. data/lib/urbanopt/reporting/default_reports/solar_pv.rb +16 -6
  34. data/lib/urbanopt/reporting/default_reports/storage.rb +16 -6
  35. data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +16 -6
  36. data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +17 -7
  37. data/lib/urbanopt/reporting/default_reports/validator.rb +16 -6
  38. data/lib/urbanopt/reporting/default_reports/wind.rb +16 -6
  39. data/lib/urbanopt/reporting/derived_extension.rb +16 -6
  40. data/lib/urbanopt/reporting/version.rb +17 -7
  41. data/urbanopt-reporting-gem.gemspec +3 -3
  42. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75187e938a1cbfabd1d74eba912af03fcd2aade54955a490d68ea1b97b229dd2
4
- data.tar.gz: 25b56a46e4569a71a7c01964bf64f2a14d8c30fdc9f6f5167fd61b40f272eb52
3
+ metadata.gz: 1d4e162fc807ce5990af2325b9d38447685379a8e799150959b983f6a0d1ae7e
4
+ data.tar.gz: 9eca8a86a802e4d4377a06bd69f539c94df3af44eee0948943e5d62325abb504
5
5
  SHA512:
6
- metadata.gz: 5a5f20c29cc1eec6aafeece4479a52c4c5a6a0ecfb0374a0b8f243551f9a7d49ecfbcf25b233ce7e19441551adcd87c5eb668ad509d4c87b0681ea1a187da6b2
7
- data.tar.gz: bccc2ad11e97d3330f2706cb9a7d32c5c0209130af88738854e6d56fb6d34b5ccfcc8b51b42633d3f359bf4c03c34d4888108528bd38c558c96ec06569c92e9d
6
+ metadata.gz: 0a9373a57c740179b972dee996a9aec5ed67bea9ddcb788060c7c6d87f197bbad13943f607245ad84faeb520832f8550ba97f20df3bf78448d8059b9d419fb81
7
+ data.tar.gz: 7e15367191df22e75ca8d0e5665d6d400f0223e051c4571fb26fbd7f1ae38a534ab2d176af68f17c45180afe427d8143f10938fba9bc28f024bd1a58d61da4ac
data/.rubocop.yml CHANGED
@@ -3,8 +3,7 @@ AllCops:
3
3
  - gems/**/*
4
4
  - measures/**/*
5
5
  - spec/files/**/measures/**/*
6
-
6
+ require: rubocop-performance
7
7
 
8
8
  inherit_from:
9
- - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
10
-
9
+ - http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
data/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # URBANopt Reporting Gem
2
2
 
3
+ ## Version 0.4.1
4
+ Date Range: 04/27/23 - 07/01/21
5
+
6
+ - Fixed [#80](https://github.com/urbanopt/urbanopt-reporting-gem/issues/80), Update rubocop configs to v4
7
+ -
8
+ ## Version 0.4.0
9
+
10
+ Date Range: 03/27/21 - 04/26/21
11
+
12
+ - Update dependencies for OpenStudio 3.2.0 and Ruby 2.7
13
+
14
+ ## Version 0.3.7
15
+
16
+ Date Range: 02/12/21 - 03/26/21
17
+
18
+ - Fixed [#47]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/47 ), Default features report bugfixes and updates
19
+ - Fixed [#67]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/67 ), Update copyrights for 2021
20
+ - Fixed [#70]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/70 ), feature report bug fix
21
+
22
+ ## Version 0.3.6
23
+
24
+ Date Range: 02/05/21 - 02/11/21
25
+
26
+ - Fixed [#64]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/64 ), EnergyPlus changed output fuel names in version 9.4
27
+
28
+ ## Version 0.3.5
29
+
30
+ Date Range: 01/16/21 - 02/04/21
31
+
32
+ - Fixed [#58]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/58 ), Feature report saving bug fix.
33
+ - Fixed [#60]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/60 ), Added EV/ ExteriorEquipment results to csv and json reports
34
+ - Fixed [#61]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/61 ), Enhance the aggregation of enduses.
35
+
36
+
3
37
  ## Version 0.3.4
4
38
 
5
39
  Date Range: 01/14/21 - 01/15/21
data/Rakefile CHANGED
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, 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,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
+ # the term “URBANopt”, or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, 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,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
+ # the term “URBANopt”, or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -26,4 +36,4 @@
26
36
  # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
37
  # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28
38
  # OF THE POSSIBILITY OF SUCH DAMAGE.
29
- # *********************************************************************************
39
+ # *********************************************************************************
@@ -1,21 +1,31 @@
1
1
  # *********************************************************************************
2
- # URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ # URBANopt™, Copyright (c) 2019-2021, 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,
6
6
  # are permitted provided that the following conditions are met:
7
- #
7
+
8
8
  # Redistributions of source code must retain the above copyright notice, this list
9
9
  # of conditions and the following disclaimer.
10
- #
10
+
11
11
  # Redistributions in binary form must reproduce the above copyright notice, this
12
12
  # list of conditions and the following disclaimer in the documentation and/or other
13
13
  # materials provided with the distribution.
14
- #
14
+
15
15
  # Neither the name of the copyright holder nor the names of its contributors may be
16
16
  # used to endorse or promote products derived from this software without specific
17
17
  # prior written permission.
18
- #
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
24
+ # the term “URBANopt”, or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
19
29
  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
30
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
31
  # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -101,10 +111,9 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
101
111
  def fuel_types
102
112
  fuel_types = {
103
113
  'Electricity' => 'Electricity',
104
- 'Gas' => 'Natural Gas',
105
- 'FuelOil#2' => 'Fuel Oil #2',
114
+ 'NaturalGas' => 'Natural Gas',
115
+ 'FuelOilNo2' => 'Fuel Oil #2',
106
116
  'Propane' => 'Propane',
107
- 'AdditionalFuel' => 'Additional Fuel',
108
117
  'DistrictCooling' => 'District Cooling',
109
118
  'DistrictHeating' => 'District Heating',
110
119
  'Water' => 'Water'
@@ -113,6 +122,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
113
122
  return fuel_types
114
123
  end
115
124
 
125
+ # define other fuel types
126
+ def other_fuels
127
+ return ['Gasoline', 'Diesel', 'Coal', 'Fuel Oil No 1', 'Other Fuel 1', 'Steam']
128
+ end
129
+
116
130
  # define enduses
117
131
  def end_uses
118
132
  end_uses = {
@@ -177,13 +191,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
177
191
  end
178
192
  end
179
193
 
180
- # OtherFuels
181
- other_fuels = ['FuelOil#1', 'Diesel', 'Gasoline', 'Coal', 'Steam']
194
+ # Create a custom meter for OtherFuels
182
195
  other_fuel_uses = ['HeatRejection', 'Heating', 'WaterSystems', 'InteriorEquipment']
183
- custom_meter_facility = 'Meter:Custom,OtherFuels:Facility,OtherFuel1'
196
+ custom_meter_facility = 'Meter:Custom,OtherFuels:Facility,OtherFuel2'
184
197
  other_fuel_uses.each do |end_use|
185
- custom_meter = "Meter:Custom,#{end_use}:OtherFuels,OtherFuel1"
198
+ custom_meter = "Meter:Custom,#{end_use}:OtherFuels,OtherFuel2"
186
199
  other_fuels.each do |other_fuel|
200
+ other_fuel = other_fuel.gsub(' ', '')
187
201
  result << OpenStudio::IdfObject.load("Output:Meter,#{end_use}:#{other_fuel},#{reporting_frequency};").get
188
202
  custom_meter_facility += ",,#{end_use}:#{other_fuel}"
189
203
  custom_meter += ",,#{end_use}:#{other_fuel}"
@@ -198,9 +212,10 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
198
212
  # Request the output for each end use/fuel type combination
199
213
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Electricity:Facility,#{reporting_frequency};").get
200
214
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,ElectricityProduced:Facility,#{reporting_frequency};").get
201
- result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Gas:Facility,#{reporting_frequency};").get
215
+ result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,NaturalGas:Facility,#{reporting_frequency};").get
202
216
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,DistrictCooling:Facility,#{reporting_frequency};").get
203
217
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,DistrictHeating:Facility,#{reporting_frequency};").get
218
+
204
219
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Cooling:Electricity,#{reporting_frequency};").get
205
220
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Heating:Electricity,#{reporting_frequency};").get
206
221
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,InteriorLights:Electricity,#{reporting_frequency};").get
@@ -209,18 +224,22 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
209
224
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Fans:Electricity,#{reporting_frequency};").get
210
225
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Pumps:Electricity,#{reporting_frequency};").get
211
226
  # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,WaterSystems:Electricity,#{reporting_frequency};").get
212
- # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Heating:Gas,#{reporting_frequency};").get
213
- # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,WaterSystems:Gas,#{reporting_frequency};").get
214
- # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,InteriorEquipment:Gas,#{reporting_frequency};").get
227
+ # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Heating:NaturalGas,#{reporting_frequency};").get
228
+ # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,WaterSystems:NaturalGas,#{reporting_frequency};").get
229
+ # result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,InteriorEquipment:NaturalGas,#{reporting_frequency};").get
215
230
  result << OpenStudio::IdfObject.load('Output:Variable,*,Heating Coil Heating Rate,hourly; !- HVAC Average [W];').get
231
+ # result << OpenStudio::IdfObject.load("Output:Variable,*,Exterior Equipment:Electric Vehicles,#{reporting_frequency};").get
216
232
 
217
233
  timeseries_data = ['District Cooling Chilled Water Rate', 'District Cooling Mass Flow Rate',
218
234
  'District Cooling Inlet Temperature', 'District Cooling Outlet Temperature',
219
235
  'District Heating Hot Water Rate', 'District Heating Mass Flow Rate',
220
236
  'District Heating Inlet Temperature', 'District Heating Outlet Temperature', 'Cooling Coil Total Cooling Rate',
221
- 'Heating Coil Heating Rate']
237
+ 'Heating Coil Heating Rate', 'ExteriorEquipment:Electricity']
222
238
 
223
239
  tes_timeseries_data = ['Ice Thermal Storage End Fraction', 'Cooling coil Ice Thermal Storage End Fraction']
240
+
241
+ ev_timeseries_data = ['Exterior Equipment:Electric Vehicles']
242
+
224
243
  timeseries_data += tes_timeseries_data
225
244
 
226
245
  timeseries_data.each do |ts|
@@ -389,27 +408,36 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
389
408
  # unconditioned_area
390
409
  unconditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Unconditioned Building Area' AND ColumnName='Area'")
391
410
  feature_report.program.unconditioned_area_sqft = convert_units(unconditioned_area, 'm^2', 'ft^2')
392
-
393
- # footprint_area
394
- feature_report.program.footprint_area_sqft = convert_units(floor_area, 'm^2', 'ft^2')
411
+ if building.standardsBuildingType.is_initialized
412
+ floor_area -= unconditioned_area if ['Residential'].include?(building.standardsBuildingType.get) # conditioned floor area only
413
+ end
395
414
 
396
415
  # maximum_number_of_stories
397
416
  number_of_stories = building.standardsNumberOfStories.get if building.standardsNumberOfStories.is_initialized
398
417
  number_of_stories ||= 1
399
418
  feature_report.program.maximum_number_of_stories = number_of_stories
400
419
 
401
- # maximum_roof_height
402
- floor_to_floor_height = building.nominalFloortoFloorHeight.to_f
403
- maximum_roof_height = number_of_stories * floor_to_floor_height
404
- feature_report.program.maximum_roof_height_ft = maximum_roof_height
405
-
406
420
  # maximum_number_of_stories_above_ground
407
421
  number_of_stories_above_ground = building.standardsNumberOfAboveGroundStories.get if building.standardsNumberOfAboveGroundStories.is_initialized
408
422
  number_of_stories_above_ground ||= 1
409
423
  feature_report.program.maximum_number_of_stories_above_ground = number_of_stories_above_ground
410
424
 
425
+ # maximum_roof_height
426
+ floor_to_floor_height = building.nominalFloortoFloorHeight.get if building.nominalFloortoFloorHeight.is_initialized
427
+ floor_to_floor_height ||= 8
428
+ feature_report.program.maximum_roof_height_ft = feature_report.program.maximum_number_of_stories_above_ground * floor_to_floor_height
429
+
430
+ # footprint_area
431
+ if building.standardsBuildingType.is_initialized
432
+ if not ['Residential'].include?(building.standardsBuildingType.get)
433
+ feature_report.program.footprint_area_sqft = feature_report.program.floor_area_sqft / number_of_stories
434
+ else
435
+ feature_report.program.footprint_area_sqft = convert_units(floor_area, 'm^2', 'ft^2') / building.additionalProperties.getFeatureAsInteger('NumberOfConditionedStories').get
436
+ end
437
+ end
438
+
411
439
  # number_of_residential_units
412
- number_of_living_units = building.standardsNumberOfLivingUnits.to_i.get if building.standardsNumberOfLivingUnits.is_initialized
440
+ number_of_living_units = building.standardsNumberOfLivingUnits.get if building.standardsNumberOfLivingUnits.is_initialized
413
441
  number_of_living_units ||= 1
414
442
  feature_report.program.number_of_residential_units = number_of_living_units
415
443
 
@@ -430,6 +458,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
430
458
  else
431
459
  building_type = building_type.get
432
460
  end
461
+ next if ['Residential'].include?(building_type) # space types with empty building type fields will inherit from the building object
433
462
  space_type_areas[building_type] = 0 if space_type_areas[building_type].nil?
434
463
  space_type_areas[building_type] += convert_units(space_type.floorArea, 'm^2', 'ft^2')
435
464
  end
@@ -605,13 +634,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
605
634
  if begin_month == 1 && begin_day_of_month == 1 && end_month == 12 && end_day_of_month == 31
606
635
  # calculate site EUI
607
636
  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
637
+ site_EUI_kbtu_per_ft2 = convert_units(total_site_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
609
638
  # add site EUI to feature report
610
639
  feature_report.reporting_periods[0].site_EUI_kwh_per_m2 = site_EUI_kwh_per_m2
611
640
  feature_report.reporting_periods[0].site_EUI_kbtu_per_ft2 = site_EUI_kbtu_per_ft2
612
641
  # calculate source EUI
613
642
  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
643
+ source_EUI_kbtu_per_ft2 = convert_units(total_source_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
615
644
  # add source EUI to feature report
616
645
  feature_report.reporting_periods[0].source_EUI_kwh_per_m2 = source_EUI_kwh_per_m2
617
646
  feature_report.reporting_periods[0].source_EUI_kbtu_per_ft2 = source_EUI_kbtu_per_ft2
@@ -634,40 +663,45 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
634
663
  feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
635
664
 
636
665
  # 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?
666
+ propane = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Propane'")
667
+ feature_report.reporting_periods[0].propane_kwh = convert_units(propane, 'GJ', 'kWh')
640
668
 
641
669
  # 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?
670
+ fuel_oil = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Fuel Oil No 2'")
671
+ feature_report.reporting_periods[0].fuel_oil_kwh = convert_units(fuel_oil, 'GJ', 'kWh')
645
672
 
646
673
  # other_fuels
647
- additional_fuel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Additional Fuel'")
648
- # ensure additional fuel is not nil
674
+ gasoline = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Gasoline'")
675
+ diesel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Diesel'")
676
+ coal = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Coal'")
677
+ fueloilno1 = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Fuel Oil No 1'")
678
+ otherfuel1 = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Other Fuel 1'")
679
+ steam = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Steam'")
680
+ # ensure not nil
649
681
  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
682
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(gasoline, 'GJ', 'kWh') unless gasoline.nil?
683
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(diesel, 'GJ', 'kWh') unless diesel.nil?
684
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(coal, 'GJ', 'kWh') unless coal.nil?
685
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(fueloilno1, 'GJ', 'kWh') unless fueloilno1.nil?
686
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(otherfuel1, 'GJ', 'kWh') unless otherfuel1.nil?
687
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(steam, 'GJ', 'kWh') unless steam.nil?
653
688
 
654
689
  # district_cooling
655
690
  district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
656
691
  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')
692
+ if building.standardsBuildingType.is_initialized
693
+ feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
659
694
  end
660
695
 
661
696
  # district_heating
662
697
  district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
663
698
  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')
699
+ if building.standardsBuildingType.is_initialized
700
+ feature_report.reporting_periods[0].district_heating_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
666
701
  end
667
702
 
668
703
  # water
669
704
  water = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Water'")
670
- # feature_report.reporting_periods[0].water = convert_units(water, 'm3', 'ft3')
671
705
  feature_report.reporting_periods[0].water_qbft = water
672
706
 
673
707
  # electricity_produced
@@ -678,34 +712,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
678
712
 
679
713
  # get fuel type as listed in the sql file
680
714
  fueltypes = fuel_types.values
681
- fueltypes.delete('Propane')
682
- fueltypes.delete('Fuel Oil #2')
683
715
 
684
716
  # get enduses as listed in the sql file
685
717
  enduses = end_uses.values
686
718
  enduses.delete('Facility')
687
719
 
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
708
-
709
720
  # loop through fuel types and enduses to fill in sql_query method
710
721
  fueltypes.each do |ft|
711
722
  enduses.each do |eu|
@@ -715,12 +726,10 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
715
726
  x = ft.tr(' ', '_').downcase
716
727
  if x.include? 'water'
717
728
  x_u = x + '_qbft'
718
- else
729
+ else
730
+ x = x.gsub('_#2', '')
719
731
  x_u = x + '_kwh'
720
732
  end
721
- if x_u == 'additional_fuel_kwh'
722
- x_u = 'other_fuels_kwh'
723
- end
724
733
  m = feature_report.reporting_periods[0].end_uses.send(x_u)
725
734
 
726
735
  y = eu.tr(' ', '_').downcase
@@ -729,17 +738,34 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
729
738
  sql_r = 0.0
730
739
  end
731
740
  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)
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')
741
+
742
+ if building.standardsBuildingType.is_initialized
743
+ sql_r = 0.0 if ['Residential'].include?(building.standardsBuildingType.get) && x_u.include?('district')
738
744
  end
739
745
  m.send("#{y}=", sql_r)
740
746
  end
741
747
  end
742
748
 
749
+ # other fuels
750
+ m = feature_report.reporting_periods[0].end_uses.send('other_fuels_kwh')
751
+ enduses.each do |eu|
752
+ y = eu.tr(' ', '_').downcase
753
+ sql_r = 0.0
754
+ other_fuels.each do |ft|
755
+ sql = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")
756
+
757
+ # ensure not nil so the equations below don't error out
758
+ if not sql.nil?
759
+ sql_r += convert_units(sql, 'GJ', 'kWh')
760
+ end
761
+ end
762
+ m.send("#{y}=", sql_r)
763
+ end
764
+
765
+ # add enduses subcategories
766
+ electric_vehicles = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses By Subcategory' AND RowName='Exterior Equipment:Electric Vehicles' AND ColumnName='Electricity'")
767
+ feature_report.reporting_periods[0].end_uses.electricity_kwh.electric_vehicles = convert_units(electric_vehicles, 'GJ', 'kWh')
768
+
743
769
  ### energy_production
744
770
  ## electricity_produced
745
771
  # photovoltaic
@@ -756,7 +782,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
756
782
  feature_report.reporting_periods[0].utility_costs_dollar[0][:fuel_type] = 'Electricity'
757
783
  feature_report.reporting_periods[0].utility_costs_dollar[0][:total_cost] = elec_utility_cost
758
784
  # gas utility cost
759
- gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
785
+ gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Natural Gas'")
760
786
  feature_report.reporting_periods[0].utility_costs_dollar << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
761
787
 
762
788
  ## comfort_result
@@ -794,31 +820,32 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
794
820
  requested_timeseries_names = [
795
821
  'Electricity:Facility',
796
822
  'ElectricityProduced:Facility',
797
- 'Gas:Facility',
823
+ 'NaturalGas:Facility',
798
824
  'Propane:Facility',
799
- 'FuelOil#2:Facility',
825
+ 'FuelOilNo2:Facility',
800
826
  'OtherFuels:Facility',
801
827
  'Cooling:Electricity',
802
828
  'Heating:Electricity',
803
829
  'InteriorLights:Electricity',
804
830
  'ExteriorLights:Electricity',
805
831
  'InteriorEquipment:Electricity',
832
+ 'ExteriorEquipment:Electricity',
806
833
  'Fans:Electricity',
807
834
  'Pumps:Electricity',
808
835
  'WaterSystems:Electricity',
809
836
  'HeatRejection:Electricity',
810
- 'HeatRejection:Gas',
811
- 'Heating:Gas',
812
- 'WaterSystems:Gas',
813
- 'InteriorEquipment:Gas',
837
+ 'HeatRejection:NaturalGas',
838
+ 'Heating:NaturalGas',
839
+ 'WaterSystems:NaturalGas',
840
+ 'InteriorEquipment:NaturalGas',
814
841
  'HeatRejection:Propane',
815
842
  'Heating:Propane',
816
843
  'WaterSystems:Propane',
817
844
  'InteriorEquipment:Propane',
818
- 'HeatRejection:FuelOil#2',
819
- 'Heating:FuelOil#2',
820
- 'WaterSystems:FuelOil#2',
821
- 'InteriorEquipment:FuelOil#2',
845
+ 'HeatRejection:FuelOilNo2',
846
+ 'Heating:FuelOilNo2',
847
+ 'WaterSystems:FuelOilNo2',
848
+ 'InteriorEquipment:FuelOilNo2',
822
849
  'HeatRejection:OtherFuels',
823
850
  'Heating:OtherFuels',
824
851
  'WaterSystems:OtherFuels',
@@ -955,14 +982,14 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
955
982
  end
956
983
 
957
984
  # 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')
985
+ if building.standardsBuildingType.is_initialized
986
+ values[key_cnt] = Array.new(n, 0) if ['DistrictCooling:Facility', 'DistrictHeating:Facility'].include?(timeseries_name) && ['Residential'].include?(building.standardsBuildingType.get)
960
987
  end
961
988
 
962
989
  # unit conversion
963
990
  old_unit = ts.get.units if ts.is_initialized
964
991
 
965
- if timeseries_name.include?('Gas') || timeseries_name.include?('Propane') || timeseries_name.include?('FuelOil#2') || timeseries_name.include?('OtherFuels')
992
+ if timeseries_name.include?('NaturalGas') || timeseries_name.include?('Propane') || timeseries_name.include?('FuelOilNo2') || timeseries_name.include?('OtherFuels')
966
993
  new_unit = 'kBtu'
967
994
  else
968
995
  new_unit = case old_unit.to_s
@@ -1151,7 +1178,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1151
1178
  # get the timeseries for any of available timeseries
1152
1179
  # RK: code enhancement needed
1153
1180
  ts_d_e = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Electricity:Facility', '')
1154
- ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Gas:Facility', '')
1181
+ ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'NaturalGas:Facility', '')
1155
1182
 
1156
1183
  if ts_d_e.is_initialized
1157
1184
  timeseries_d = ts_d_e.get