urbanopt-reporting 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/LICENSE.md +29 -17
  4. data/Rakefile +16 -6
  5. data/doc_templates/copyright_ruby.txt +17 -7
  6. data/lib/measures/default_feature_reports/measure.rb +91 -76
  7. data/lib/urbanopt/reporting.rb +16 -6
  8. data/lib/urbanopt/reporting/default_reports.rb +16 -6
  9. data/lib/urbanopt/reporting/default_reports/construction_cost.rb +16 -6
  10. data/lib/urbanopt/reporting/default_reports/date.rb +16 -6
  11. data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +16 -6
  12. data/lib/urbanopt/reporting/default_reports/end_use.rb +16 -6
  13. data/lib/urbanopt/reporting/default_reports/end_uses.rb +16 -6
  14. data/lib/urbanopt/reporting/default_reports/extension.rb +16 -6
  15. data/lib/urbanopt/reporting/default_reports/feature_report.rb +18 -6
  16. data/lib/urbanopt/reporting/default_reports/generator.rb +16 -6
  17. data/lib/urbanopt/reporting/default_reports/location.rb +16 -6
  18. data/lib/urbanopt/reporting/default_reports/logger.rb +16 -6
  19. data/lib/urbanopt/reporting/default_reports/power_distribution.rb +16 -6
  20. data/lib/urbanopt/reporting/default_reports/program.rb +17 -7
  21. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +16 -6
  22. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +17 -7
  23. data/lib/urbanopt/reporting/default_reports/solar_pv.rb +16 -6
  24. data/lib/urbanopt/reporting/default_reports/storage.rb +16 -6
  25. data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +16 -6
  26. data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +17 -7
  27. data/lib/urbanopt/reporting/default_reports/validator.rb +16 -6
  28. data/lib/urbanopt/reporting/default_reports/wind.rb +16 -6
  29. data/lib/urbanopt/reporting/derived_extension.rb +16 -6
  30. data/lib/urbanopt/reporting/version.rb +17 -7
  31. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62dbeebffeb4088f111f04c86062b6c2db3a9f061ccf7dc6a84b1a5824456272
4
- data.tar.gz: 705785c0bdbe0725ab6814be1a263627f1daf64d8cddab12efce59276bdca1bf
3
+ metadata.gz: c7f77ced3ece4ad3c08bc93a92108e57b4fc83bbd982304d2ceee67b5f6260ab
4
+ data.tar.gz: 026a4b1d4fd2bfe3690444092eee67ef47c936a5bbdbcc6318c4c0403b2ddf1e
5
5
  SHA512:
6
- metadata.gz: a76f98043801029d98477f18fa123aafd5f84fc46977b5ebb2ee946d1d09b68d7d560e392e87418742abc66faf7ebc8df9cd9be65e1d18e9183e0a259d7d353e
7
- data.tar.gz: 87e1cd2f3615e3845f50c7af04d685c72cc4242bb5d545f20c6821807cf55196c65a4a328534cb850069225d2653b2d1b4872cf4d3f07d7e9deea85c3502f4a8
6
+ metadata.gz: 95161e4c8f6019163f112607c2c6d7576b1eb436a89f90ce91434e21096debfe7ee488c78fb107cd92eccedceab61700b1632333f7819b684bc05e9f611cf06f
7
+ data.tar.gz: 988b4612f950580f7baeaadc10845f71e5e5be954143f5374e9615184d74fee37893c7110682bc1476319faa536283350956e480c5fe603f12f1d531af438b14
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # URBANopt Reporting Gem
2
2
 
3
+ ## Version 0.3.7
4
+ Date Range: 02/12/21 - 03/26/21
5
+
6
+ - Fixed [#47]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/47 ), Default features report bugfixes and updates
7
+ - Fixed [#67]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/67 ), Update copyrights for 2021
8
+ - Fixed [#70]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/70 ), feature report bug fix
9
+
3
10
  ## Version 0.3.6
4
11
 
5
12
  Date Range: 02/05/21 - 02/11/21
data/LICENSE.md CHANGED
@@ -1,27 +1,39 @@
1
- URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
1
+ # License
2
+
3
+ URBANopt™, Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
2
4
  contributors. All rights reserved.
3
5
 
4
- Redistribution and use in source and binary forms, with or without modification,
6
+ Redistribution and use in source and binary forms, with or without modification,
5
7
  are permitted provided that the following conditions are met:
6
8
 
7
- Redistributions of source code must retain the above copyright notice, this list
9
+ Redistributions of source code must retain the above copyright notice, this list
8
10
  of conditions and the following disclaimer.
9
11
 
10
- Redistributions in binary form must reproduce the above copyright notice, this
11
- list of conditions and the following disclaimer in the documentation and/or other
12
+ Redistributions in binary form must reproduce the above copyright notice, this
13
+ list of conditions and the following disclaimer in the documentation and/or other
12
14
  materials provided with the distribution.
13
-
14
- Neither the name of the copyright holder nor the names of its contributors may be
15
- used to endorse or promote products derived from this software without specific
15
+
16
+ Neither the name of the copyright holder nor the names of its contributors may be
17
+ used to endorse or promote products derived from this software without specific
16
18
  prior written permission.
17
19
 
18
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
20
+ Redistribution of this software, without modification, must refer to the software
21
+ by the same designation. Redistribution of a modified version of this software
22
+ (i) may not refer to the modified version by the same designation, or by any
23
+ confusingly similar designation, and (ii) must refer to the underlying software
24
+ originally provided by Alliance as “URBANopt”. Except to comply with the foregoing,
25
+ the term “URBANopt”, or any confusingly similar designation may not be used to
26
+ refer to any modified version of this software or any modified version of the
27
+ underlying software originally provided by Alliance without the prior written
28
+ consent of Alliance.
29
+
30
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
31
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
33
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
34
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
37
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
38
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27
39
  OF THE POSSIBILITY OF SUCH DAMAGE.
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.
@@ -112,6 +122,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
112
122
  return fuel_types
113
123
  end
114
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
+
115
130
  # define enduses
116
131
  def end_uses
117
132
  end_uses = {
@@ -176,13 +191,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
176
191
  end
177
192
  end
178
193
 
179
- # OtherFuels
180
- other_fuels = ['FuelOil#1', 'Diesel', 'Gasoline', 'Coal', 'Steam']
194
+ # Create a custom meter for OtherFuels
181
195
  other_fuel_uses = ['HeatRejection', 'Heating', 'WaterSystems', 'InteriorEquipment']
182
- custom_meter_facility = 'Meter:Custom,OtherFuels:Facility,OtherFuel1'
196
+ custom_meter_facility = 'Meter:Custom,OtherFuels:Facility,OtherFuel2'
183
197
  other_fuel_uses.each do |end_use|
184
- custom_meter = "Meter:Custom,#{end_use}:OtherFuels,OtherFuel1"
198
+ custom_meter = "Meter:Custom,#{end_use}:OtherFuels,OtherFuel2"
185
199
  other_fuels.each do |other_fuel|
200
+ other_fuel = other_fuel.gsub(' ', '')
186
201
  result << OpenStudio::IdfObject.load("Output:Meter,#{end_use}:#{other_fuel},#{reporting_frequency};").get
187
202
  custom_meter_facility += ",,#{end_use}:#{other_fuel}"
188
203
  custom_meter += ",,#{end_use}:#{other_fuel}"
@@ -197,7 +212,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
197
212
  # Request the output for each end use/fuel type combination
198
213
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,Electricity:Facility,#{reporting_frequency};").get
199
214
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,ElectricityProduced:Facility,#{reporting_frequency};").get
200
- 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
201
216
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,DistrictCooling:Facility,#{reporting_frequency};").get
202
217
  result << OpenStudio::IdfObject.load("Output:Meter:MeterFileOnly,DistrictHeating:Facility,#{reporting_frequency};").get
203
218
 
@@ -393,27 +408,34 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
393
408
  # unconditioned_area
394
409
  unconditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Unconditioned Building Area' AND ColumnName='Area'")
395
410
  feature_report.program.unconditioned_area_sqft = convert_units(unconditioned_area, 'm^2', 'ft^2')
396
-
397
- # footprint_area
398
- 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
399
414
 
400
415
  # maximum_number_of_stories
401
416
  number_of_stories = building.standardsNumberOfStories.get if building.standardsNumberOfStories.is_initialized
402
417
  number_of_stories ||= 1
403
418
  feature_report.program.maximum_number_of_stories = number_of_stories
404
419
 
405
- # maximum_roof_height
406
- floor_to_floor_height = building.nominalFloortoFloorHeight.to_f
407
- maximum_roof_height = number_of_stories * floor_to_floor_height
408
- feature_report.program.maximum_roof_height_ft = maximum_roof_height
409
-
410
420
  # maximum_number_of_stories_above_ground
411
421
  number_of_stories_above_ground = building.standardsNumberOfAboveGroundStories.get if building.standardsNumberOfAboveGroundStories.is_initialized
412
422
  number_of_stories_above_ground ||= 1
413
423
  feature_report.program.maximum_number_of_stories_above_ground = number_of_stories_above_ground
414
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 not ['Residential'].include?(building.standardsBuildingType.get)
432
+ feature_report.program.footprint_area_sqft = feature_report.program.floor_area_sqft / number_of_stories
433
+ else
434
+ feature_report.program.footprint_area_sqft = convert_units(floor_area, 'm^2', 'ft^2') / building.additionalProperties.getFeatureAsInteger('NumberOfConditionedStories').get
435
+ end
436
+
415
437
  # number_of_residential_units
416
- number_of_living_units = building.standardsNumberOfLivingUnits.to_i.get if building.standardsNumberOfLivingUnits.is_initialized
438
+ number_of_living_units = building.standardsNumberOfLivingUnits.get if building.standardsNumberOfLivingUnits.is_initialized
417
439
  number_of_living_units ||= 1
418
440
  feature_report.program.number_of_residential_units = number_of_living_units
419
441
 
@@ -434,6 +456,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
434
456
  else
435
457
  building_type = building_type.get
436
458
  end
459
+ next if ['Residential'].include?(building_type) # space types with empty building type fields will inherit from the building object
437
460
  space_type_areas[building_type] = 0 if space_type_areas[building_type].nil?
438
461
  space_type_areas[building_type] += convert_units(space_type.floorArea, 'm^2', 'ft^2')
439
462
  end
@@ -609,13 +632,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
609
632
  if begin_month == 1 && begin_day_of_month == 1 && end_month == 12 && end_day_of_month == 31
610
633
  # calculate site EUI
611
634
  site_EUI_kwh_per_m2 = feature_report.reporting_periods[0].total_site_energy_kwh / floor_area
612
- site_EUI_kbtu_per_ft2 = convert_units(total_site_energy, 'GJ', 'kBtu') / feature_report.program.floor_area_sqft
635
+ site_EUI_kbtu_per_ft2 = convert_units(total_site_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
613
636
  # add site EUI to feature report
614
637
  feature_report.reporting_periods[0].site_EUI_kwh_per_m2 = site_EUI_kwh_per_m2
615
638
  feature_report.reporting_periods[0].site_EUI_kbtu_per_ft2 = site_EUI_kbtu_per_ft2
616
639
  # calculate source EUI
617
640
  source_EUI_kwh_per_m2 = feature_report.reporting_periods[0].total_source_energy_kwh / floor_area
618
- source_EUI_kbtu_per_ft2 = convert_units(total_source_energy, 'GJ', 'kBtu') / feature_report.program.floor_area_sqft
641
+ source_EUI_kbtu_per_ft2 = convert_units(total_source_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
619
642
  # add source EUI to feature report
620
643
  feature_report.reporting_periods[0].source_EUI_kwh_per_m2 = source_EUI_kwh_per_m2
621
644
  feature_report.reporting_periods[0].source_EUI_kbtu_per_ft2 = source_EUI_kbtu_per_ft2
@@ -638,40 +661,45 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
638
661
  feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
639
662
 
640
663
  # propane
641
- propane = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='Propane:Facility' AND ColumnName='Annual Value'")
642
- feature_report.reporting_periods[0].propane_kwh = 0.0
643
- feature_report.reporting_periods[0].propane_kwh = convert_units(propane, 'GJ', 'kWh') unless propane.nil?
664
+ propane = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Propane'")
665
+ feature_report.reporting_periods[0].propane_kwh = convert_units(propane, 'GJ', 'kWh')
644
666
 
645
667
  # fuel_oil
646
- fuel_oil = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='FuelOilNo2:Facility' AND ColumnName='Annual Value'")
647
- feature_report.reporting_periods[0].fuel_oil_kwh = 0.0
648
- feature_report.reporting_periods[0].fuel_oil_kwh = convert_units(fuel_oil, 'GJ', 'kWh') unless fuel_oil.nil?
668
+ fuel_oil = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Fuel Oil No 2'")
669
+ feature_report.reporting_periods[0].fuel_oil_kwh = convert_units(fuel_oil, 'GJ', 'kWh')
649
670
 
650
671
  # other_fuels
651
- additional_fuel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Additional Fuel'")
652
- # ensure additional fuel is not nil
672
+ gasoline = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Gasoline'")
673
+ diesel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Diesel'")
674
+ coal = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Coal'")
675
+ fueloilno1 = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Fuel Oil No 1'")
676
+ otherfuel1 = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Other Fuel 1'")
677
+ steam = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Steam'")
678
+ # ensure not nil
653
679
  feature_report.reporting_periods[0].other_fuels_kwh = 0.0
654
- feature_report.reporting_periods[0].other_fuels_kwh = convert_units(additional_fuel, 'GJ', 'kWh') unless additional_fuel.nil?
655
- feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].propane_kwh
656
- feature_report.reporting_periods[0].other_fuels_kwh -= feature_report.reporting_periods[0].fuel_oil_kwh
680
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(gasoline, 'GJ', 'kWh') unless gasoline.nil?
681
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(diesel, 'GJ', 'kWh') unless diesel.nil?
682
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(coal, 'GJ', 'kWh') unless coal.nil?
683
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(fueloilno1, 'GJ', 'kWh') unless fueloilno1.nil?
684
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(otherfuel1, 'GJ', 'kWh') unless otherfuel1.nil?
685
+ feature_report.reporting_periods[0].other_fuels_kwh += convert_units(steam, 'GJ', 'kWh') unless steam.nil?
657
686
 
658
687
  # district_cooling
659
688
  district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
660
689
  feature_report.reporting_periods[0].district_cooling_kwh = convert_units(district_cooling, 'GJ', 'kWh')
661
- building_types.each do |i|
662
- feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
690
+ if building.standardsBuildingType.is_initialized
691
+ feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
663
692
  end
664
693
 
665
694
  # district_heating
666
695
  district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
667
696
  feature_report.reporting_periods[0].district_heating_kwh = convert_units(district_heating, 'GJ', 'kWh')
668
- building_types.each do |i|
669
- feature_report.reporting_periods[0].district_heating_kwh = 0.0 if i[:building_type].include?('Single-Family Detached')
697
+ if building.standardsBuildingType.is_initialized
698
+ feature_report.reporting_periods[0].district_heating_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
670
699
  end
671
700
 
672
701
  # water
673
702
  water = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Water'")
674
- # feature_report.reporting_periods[0].water = convert_units(water, 'm3', 'ft3')
675
703
  feature_report.reporting_periods[0].water_qbft = water
676
704
 
677
705
  # electricity_produced
@@ -682,34 +710,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
682
710
 
683
711
  # get fuel type as listed in the sql file
684
712
  fueltypes = fuel_types.values
685
- fueltypes.delete('Propane')
686
- fueltypes.delete('Fuel Oil #2')
687
713
 
688
714
  # get enduses as listed in the sql file
689
715
  enduses = end_uses.values
690
716
  enduses.delete('Facility')
691
717
 
692
- # propane / fuel_oil
693
- ['Propane', 'Fuel Oil #2'].each do |ft|
694
- end_uses.keys.each do |eu|
695
- next if eu == 'Facility'
696
-
697
- sql_r = sql_query(runner, sql_file, 'EnergyMeters', "TableName='Annual and Peak Values - Other' AND RowName='#{eu}:#{ft.tr(' ', '')}' AND ColumnName='Annual Value'")
698
-
699
- # report each query in its corresponding feature report obeject
700
- x = ft.tr(' ', '_').downcase
701
- x = x.gsub('_#2', '')
702
- x_u = x + '_kwh'
703
- m = feature_report.reporting_periods[0].end_uses.send(x_u)
704
-
705
- y = end_uses[eu].tr(' ', '_').downcase
706
- if sql_r.nil?
707
- sql_r = 0.0
708
- end
709
- m.send("#{y}=", convert_units(sql_r, 'GJ', 'kWh'))
710
- end
711
- end
712
-
713
718
  # loop through fuel types and enduses to fill in sql_query method
714
719
  fueltypes.each do |ft|
715
720
  enduses.each do |eu|
@@ -719,12 +724,10 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
719
724
  x = ft.tr(' ', '_').downcase
720
725
  if x.include? 'water'
721
726
  x_u = x + '_qbft'
722
- else
727
+ else
728
+ x = x.gsub('_#2', '')
723
729
  x_u = x + '_kwh'
724
730
  end
725
- if x_u == 'additional_fuel_kwh'
726
- x_u = 'other_fuels_kwh'
727
- end
728
731
  m = feature_report.reporting_periods[0].end_uses.send(x_u)
729
732
 
730
733
  y = eu.tr(' ', '_').downcase
@@ -733,20 +736,32 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
733
736
  sql_r = 0.0
734
737
  end
735
738
  sql_r = convert_units(sql_r, 'GJ', 'kWh')
736
- if x_u == 'other_fuels_kwh'
737
- sql_r -= feature_report.reporting_periods[0].end_uses.propane_kwh.send(y)
738
- sql_r -= feature_report.reporting_periods[0].end_uses.fuel_oil_kwh.send(y)
739
- end
740
- building_types.each do |i|
741
- sql_r = 0.0 if i[:building_type].include?('Single-Family Detached') && x_u.include?('district')
739
+
740
+ if building.standardsBuildingType.is_initialized
741
+ sql_r = 0.0 if ['Residential'].include?(building.standardsBuildingType.get) && x_u.include?('district')
742
742
  end
743
743
  m.send("#{y}=", sql_r)
744
744
  end
745
745
  end
746
746
 
747
+ # other fuels
748
+ m = feature_report.reporting_periods[0].end_uses.send('other_fuels_kwh')
749
+ enduses.each do |eu|
750
+ y = eu.tr(' ', '_').downcase
751
+ sql_r = 0.0
752
+ other_fuels.each do |ft|
753
+ sql = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")
754
+
755
+ # ensure not nil so the equations below don't error out
756
+ if not sql.nil?
757
+ sql_r += convert_units(sql, 'GJ', 'kWh')
758
+ end
759
+ end
760
+ m.send("#{y}=", sql_r)
761
+ end
762
+
747
763
  # add enduses subcategories
748
764
  electric_vehicles = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses By Subcategory' AND RowName='Exterior Equipment:Electric Vehicles' AND ColumnName='Electricity'")
749
- puts "electric_vehicle = #{electric_vehicles}"
750
765
  feature_report.reporting_periods[0].end_uses.electricity_kwh.electric_vehicles = convert_units(electric_vehicles, 'GJ', 'kWh')
751
766
 
752
767
  ### energy_production
@@ -765,7 +780,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
765
780
  feature_report.reporting_periods[0].utility_costs_dollar[0][:fuel_type] = 'Electricity'
766
781
  feature_report.reporting_periods[0].utility_costs_dollar[0][:total_cost] = elec_utility_cost
767
782
  # gas utility cost
768
- gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
783
+ gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Natural Gas'")
769
784
  feature_report.reporting_periods[0].utility_costs_dollar << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
770
785
 
771
786
  ## comfort_result
@@ -965,8 +980,8 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
965
980
  end
966
981
 
967
982
  # residential considerations
968
- building_types.each do |i|
969
- values[key_cnt] = Array.new(n, 0) if ['DistrictCooling:Facility', 'DistrictHeating:Facility'].include?(timeseries_name) && i[:building_type].include?('Single-Family Detached')
983
+ if building.standardsBuildingType.is_initialized
984
+ values[key_cnt] = Array.new(n, 0) if ['DistrictCooling:Facility', 'DistrictHeating:Facility'].include?(timeseries_name) && ['Residential'].include?(building.standardsBuildingType.get)
970
985
  end
971
986
 
972
987
  # unit conversion
@@ -1161,7 +1176,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1161
1176
  # get the timeseries for any of available timeseries
1162
1177
  # RK: code enhancement needed
1163
1178
  ts_d_e = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Electricity:Facility', '')
1164
- ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'Gas:Facility', '')
1179
+ ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'NaturalGas:Facility', '')
1165
1180
 
1166
1181
  if ts_d_e.is_initialized
1167
1182
  timeseries_d = ts_d_e.get