urbanopt-reporting 0.3.6 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -3
  3. data/CHANGELOG.md +25 -0
  4. data/Rakefile +16 -6
  5. data/doc_templates/copyright_ruby.txt +17 -7
  6. data/lib/measures/default_feature_reports/measure.rb +93 -76
  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 +40 -49
  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 +39 -34
  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/default_reports/construction_cost.rb +16 -6
  16. data/lib/urbanopt/reporting/default_reports/date.rb +16 -6
  17. data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +16 -6
  18. data/lib/urbanopt/reporting/default_reports/end_use.rb +16 -6
  19. data/lib/urbanopt/reporting/default_reports/end_uses.rb +16 -6
  20. data/lib/urbanopt/reporting/default_reports/extension.rb +16 -6
  21. data/lib/urbanopt/reporting/default_reports/feature_report.rb +18 -6
  22. data/lib/urbanopt/reporting/default_reports/generator.rb +16 -6
  23. data/lib/urbanopt/reporting/default_reports/location.rb +16 -6
  24. data/lib/urbanopt/reporting/default_reports/logger.rb +16 -6
  25. data/lib/urbanopt/reporting/default_reports/power_distribution.rb +16 -6
  26. data/lib/urbanopt/reporting/default_reports/program.rb +17 -7
  27. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +16 -6
  28. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +17 -7
  29. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +9 -0
  30. data/lib/urbanopt/reporting/default_reports/solar_pv.rb +19 -6
  31. data/lib/urbanopt/reporting/default_reports/storage.rb +16 -6
  32. data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +16 -6
  33. data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +17 -7
  34. data/lib/urbanopt/reporting/default_reports/validator.rb +16 -6
  35. data/lib/urbanopt/reporting/default_reports/wind.rb +16 -6
  36. data/lib/urbanopt/reporting/default_reports.rb +16 -6
  37. data/lib/urbanopt/reporting/derived_extension.rb +16 -6
  38. data/lib/urbanopt/reporting/version.rb +17 -7
  39. data/lib/urbanopt/reporting.rb +16 -6
  40. data/urbanopt-reporting-gem.gemspec +3 -3
  41. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62dbeebffeb4088f111f04c86062b6c2db3a9f061ccf7dc6a84b1a5824456272
4
- data.tar.gz: 705785c0bdbe0725ab6814be1a263627f1daf64d8cddab12efce59276bdca1bf
3
+ metadata.gz: 86865f249cc5ec5b04615f5551aa21d0398ccf6eb537a8ecc620dadc5c1031bb
4
+ data.tar.gz: f247f3ab2bb38327b1cabdaeca617d0f2b31ba529adb4e3f80f271cc340b4f2b
5
5
  SHA512:
6
- metadata.gz: a76f98043801029d98477f18fa123aafd5f84fc46977b5ebb2ee946d1d09b68d7d560e392e87418742abc66faf7ebc8df9cd9be65e1d18e9183e0a259d7d353e
7
- data.tar.gz: 87e1cd2f3615e3845f50c7af04d685c72cc4242bb5d545f20c6821807cf55196c65a4a328534cb850069225d2653b2d1b4872cf4d3f07d7e9deea85c3502f4a8
6
+ metadata.gz: 5109069f60e3bc7da3eb3aae042d175cd8140b3918f5c9ccc121889eaa9c656ae578dc19b5f57511939f6989ea450e1304fd70a782f3416302fd7ec0bd89a67e
7
+ data.tar.gz: 5739391c194b4e46bfcf803c1b7c7e9b1bcaca7e46f6e15fdf02b764e13a1151fecd8ab454d503203f218837f6bee48f4e866a44f578b223062b971727b93f00
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,30 @@
1
1
  # URBANopt Reporting Gem
2
2
 
3
+ ## Version 0.4.2
4
+ Date Range: 07/01/21 - 10/15/21
5
+
6
+ - Fixed [#86]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/86 ), Add location of PV to Scenario and Feature optimization reopt reports #86
7
+ - Fixed [#77]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/77 ), Fix test_with_openstudio model failures
8
+
9
+ ## Version 0.4.1
10
+ Date Range: 04/27/23 - 07/01/21
11
+
12
+ - Fixed [#80](https://github.com/urbanopt/urbanopt-reporting-gem/issues/80), Update rubocop configs to v4
13
+ -
14
+ ## Version 0.4.0
15
+
16
+ Date Range: 03/27/21 - 04/26/21
17
+
18
+ - Update dependencies for OpenStudio 3.2.0 and Ruby 2.7
19
+
20
+ ## Version 0.3.7
21
+
22
+ Date Range: 02/12/21 - 03/26/21
23
+
24
+ - Fixed [#47]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/47 ), Default features report bugfixes and updates
25
+ - Fixed [#67]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/67 ), Update copyrights for 2021
26
+ - Fixed [#70]( https://github.com/urbanopt/urbanopt-reporting-gem/issues/70 ), feature report bug fix
27
+
3
28
  ## Version 0.3.6
4
29
 
5
30
  Date Range: 02/05/21 - 02/11/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.
@@ -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,36 @@ 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 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
+
415
439
  # number_of_residential_units
416
- 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
417
441
  number_of_living_units ||= 1
418
442
  feature_report.program.number_of_residential_units = number_of_living_units
419
443
 
@@ -434,6 +458,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
434
458
  else
435
459
  building_type = building_type.get
436
460
  end
461
+ next if ['Residential'].include?(building_type) # space types with empty building type fields will inherit from the building object
437
462
  space_type_areas[building_type] = 0 if space_type_areas[building_type].nil?
438
463
  space_type_areas[building_type] += convert_units(space_type.floorArea, 'm^2', 'ft^2')
439
464
  end
@@ -609,13 +634,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
609
634
  if begin_month == 1 && begin_day_of_month == 1 && end_month == 12 && end_day_of_month == 31
610
635
  # calculate site EUI
611
636
  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
637
+ site_EUI_kbtu_per_ft2 = convert_units(total_site_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
613
638
  # add site EUI to feature report
614
639
  feature_report.reporting_periods[0].site_EUI_kwh_per_m2 = site_EUI_kwh_per_m2
615
640
  feature_report.reporting_periods[0].site_EUI_kbtu_per_ft2 = site_EUI_kbtu_per_ft2
616
641
  # calculate source EUI
617
642
  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
643
+ source_EUI_kbtu_per_ft2 = convert_units(total_source_energy, 'GJ', 'kBtu') / convert_units(floor_area, 'm^2', 'ft^2')
619
644
  # add source EUI to feature report
620
645
  feature_report.reporting_periods[0].source_EUI_kwh_per_m2 = source_EUI_kwh_per_m2
621
646
  feature_report.reporting_periods[0].source_EUI_kbtu_per_ft2 = source_EUI_kbtu_per_ft2
@@ -638,40 +663,45 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
638
663
  feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
639
664
 
640
665
  # 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?
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')
644
668
 
645
669
  # 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?
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')
649
672
 
650
673
  # 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
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
653
681
  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
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?
657
688
 
658
689
  # district_cooling
659
690
  district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
660
691
  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')
692
+ if building.standardsBuildingType.is_initialized
693
+ feature_report.reporting_periods[0].district_cooling_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
663
694
  end
664
695
 
665
696
  # district_heating
666
697
  district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
667
698
  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')
699
+ if building.standardsBuildingType.is_initialized
700
+ feature_report.reporting_periods[0].district_heating_kwh = 0.0 if ['Residential'].include?(building.standardsBuildingType.get)
670
701
  end
671
702
 
672
703
  # water
673
704
  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
705
  feature_report.reporting_periods[0].water_qbft = water
676
706
 
677
707
  # electricity_produced
@@ -682,34 +712,11 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
682
712
 
683
713
  # get fuel type as listed in the sql file
684
714
  fueltypes = fuel_types.values
685
- fueltypes.delete('Propane')
686
- fueltypes.delete('Fuel Oil #2')
687
715
 
688
716
  # get enduses as listed in the sql file
689
717
  enduses = end_uses.values
690
718
  enduses.delete('Facility')
691
719
 
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
720
  # loop through fuel types and enduses to fill in sql_query method
714
721
  fueltypes.each do |ft|
715
722
  enduses.each do |eu|
@@ -719,12 +726,10 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
719
726
  x = ft.tr(' ', '_').downcase
720
727
  if x.include? 'water'
721
728
  x_u = x + '_qbft'
722
- else
729
+ else
730
+ x = x.gsub('_#2', '')
723
731
  x_u = x + '_kwh'
724
732
  end
725
- if x_u == 'additional_fuel_kwh'
726
- x_u = 'other_fuels_kwh'
727
- end
728
733
  m = feature_report.reporting_periods[0].end_uses.send(x_u)
729
734
 
730
735
  y = eu.tr(' ', '_').downcase
@@ -733,20 +738,32 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
733
738
  sql_r = 0.0
734
739
  end
735
740
  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')
741
+
742
+ if building.standardsBuildingType.is_initialized
743
+ sql_r = 0.0 if ['Residential'].include?(building.standardsBuildingType.get) && x_u.include?('district')
742
744
  end
743
745
  m.send("#{y}=", sql_r)
744
746
  end
745
747
  end
746
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
+
747
765
  # add enduses subcategories
748
766
  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
767
  feature_report.reporting_periods[0].end_uses.electricity_kwh.electric_vehicles = convert_units(electric_vehicles, 'GJ', 'kWh')
751
768
 
752
769
  ### energy_production
@@ -765,7 +782,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
765
782
  feature_report.reporting_periods[0].utility_costs_dollar[0][:fuel_type] = 'Electricity'
766
783
  feature_report.reporting_periods[0].utility_costs_dollar[0][:total_cost] = elec_utility_cost
767
784
  # 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'")
785
+ gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Natural Gas'")
769
786
  feature_report.reporting_periods[0].utility_costs_dollar << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
770
787
 
771
788
  ## comfort_result
@@ -965,8 +982,8 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
965
982
  end
966
983
 
967
984
  # 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')
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)
970
987
  end
971
988
 
972
989
  # unit conversion
@@ -1161,7 +1178,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1161
1178
  # get the timeseries for any of available timeseries
1162
1179
  # RK: code enhancement needed
1163
1180
  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', '')
1181
+ ts_d_g = sql_file.timeSeries(ann_env_pd.to_s, reporting_frequency.to_s, 'NaturalGas:Facility', '')
1165
1182
 
1166
1183
  if ts_d_e.is_initialized
1167
1184
  timeseries_d = ts_d_e.get
@@ -1,10 +1,11 @@
1
1
  <?xml version="1.0"?>
2
2
  <measure>
3
3
  <schema_version>3.0</schema_version>
4
+ <error>wrong number of arguments (given 1, expected 0)</error>
4
5
  <name>default_feature_reports</name>
5
6
  <uid>9ee3135a-8070-4408-bfa1-b75fecf9dd4f</uid>
6
- <version_id>d4f5b2e2-f93d-4ce2-9c68-ed29714fdc0c</version_id>
7
- <version_modified>20201208T230102Z</version_modified>
7
+ <version_id>136d51d4-9a61-48cd-b068-0e02c4094e76</version_id>
8
+ <version_modified>20210427T174740Z</version_modified>
8
9
  <xml_checksum>FB304155</xml_checksum>
9
10
  <class_name>DefaultFeatureReports</class_name>
10
11
  <display_name>DefaultFeatureReports</display_name>
@@ -120,12 +121,6 @@
120
121
  <usage_type>readmeerb</usage_type>
121
122
  <checksum>703C9964</checksum>
122
123
  </file>
123
- <file>
124
- <filename>example_model.osm</filename>
125
- <filetype>osm</filetype>
126
- <usage_type>test</usage_type>
127
- <checksum>CC4BFFAF</checksum>
128
- </file>
129
124
  <file>
130
125
  <filename>README.md</filename>
131
126
  <filetype>md</filetype>
@@ -138,11 +133,17 @@
138
133
  <usage_type>license</usage_type>
139
134
  <checksum>BBD19F47</checksum>
140
135
  </file>
136
+ <file>
137
+ <filename>example_model.osm</filename>
138
+ <filetype>osm</filetype>
139
+ <usage_type>test</usage_type>
140
+ <checksum>A178EC04</checksum>
141
+ </file>
141
142
  <file>
142
143
  <filename>default_feature_reports_test.rb</filename>
143
144
  <filetype>rb</filetype>
144
145
  <usage_type>test</usage_type>
145
- <checksum>19681175</checksum>
146
+ <checksum>0C4ED2E7</checksum>
146
147
  </file>
147
148
  <file>
148
149
  <version>
@@ -153,8 +154,7 @@
153
154
  <filename>measure.rb</filename>
154
155
  <filetype>rb</filetype>
155
156
  <usage_type>script</usage_type>
156
- <checksum>48AEB753</checksum>
157
+ <checksum>CD1AFD42</checksum>
157
158
  </file>
158
159
  </files>
159
160
  </measure>
160
- <error>wrong number of arguments (given 1, expected 0)</error>
@@ -1,27 +1,27 @@
1
- OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. All rights reserved.
1
+ URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
2
+ contributors. All rights reserved.
2
3
 
3
- Redistribution and use in source and binary forms, with or without modification, are permitted
4
- provided that the following conditions are met:
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
5
6
 
6
- (1) Redistributions of source code must retain the above copyright notice, this list of conditions
7
- and the following disclaimer.
7
+ Redistributions of source code must retain the above copyright notice, this list
8
+ of conditions and the following disclaimer.
8
9
 
9
- (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10
- and the following disclaimer in the documentation and/or other materials provided with the distribution.
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
+ 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
16
+ prior written permission.
11
17
 
12
- (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
13
- or promote products derived from this software without specific prior written permission from the
14
- respective party.
15
-
16
- (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
17
- derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
18
- designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
21
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
23
- OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
- OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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
27
+ OF THE POSSIBILITY OF SUCH DAMAGE.