urbanopt-reporting 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- data/.github/pull_request_template.md +13 -0
- data/.rdoc_options +36 -0
- data/CHANGELOG.md +10 -0
- data/RDOC_MAIN.md +10 -0
- data/deploy_docs.sh +5 -0
- data/docs/.gitignore +3 -0
- data/docs/.vuepress/components/InnerJsonSchema.vue +76 -0
- data/docs/.vuepress/components/JsonSchema.vue +12 -0
- data/docs/.vuepress/components/ScenarioSchema.vue +12 -0
- data/docs/.vuepress/components/StaticLink.vue +8 -0
- data/docs/.vuepress/config.js +25 -0
- data/docs/.vuepress/highlight.js +8 -0
- data/docs/.vuepress/json-schema-deref-loader.js +22 -0
- data/docs/.vuepress/public/custom_rdoc_styles.css +78 -0
- data/docs/.vuepress/styles/palette.styl +1 -0
- data/docs/.vuepress/utils.js +17 -0
- data/docs/README.md +9 -0
- data/docs/package-lock.json +10018 -0
- data/docs/package.json +30 -0
- data/docs/schemas/scenario-schema.md +3 -0
- data/lib/measures/default_feature_reports/measure.rb +53 -44
- data/lib/urbanopt/reporting/default_reports/end_uses.rb +38 -38
- data/lib/urbanopt/reporting/default_reports/feature_report.rb +35 -19
- data/lib/urbanopt/reporting/default_reports/location.rb +11 -11
- data/lib/urbanopt/reporting/default_reports/program.rb +86 -86
- data/lib/urbanopt/reporting/default_reports/reporting_period.rb +78 -78
- data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +80 -80
- data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +10 -10
- data/lib/urbanopt/reporting/version.rb +1 -1
- data/urbanopt-reporting-gem.gemspec +4 -4
- metadata +35 -13
    
        data/docs/package.json
    ADDED
    
    | @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "name": "urbanopt-reporting-gem-docs",
         | 
| 3 | 
            +
              "version": "0.0.1",
         | 
| 4 | 
            +
              "description": "",
         | 
| 5 | 
            +
              "main": "index.js",
         | 
| 6 | 
            +
              "scripts": {
         | 
| 7 | 
            +
                "dev": "vuepress dev",
         | 
| 8 | 
            +
                "build": "vuepress build",
         | 
| 9 | 
            +
                "deploy": "gh-pages -d .vuepress/dist"
         | 
| 10 | 
            +
              },
         | 
| 11 | 
            +
              "author": "NREL",
         | 
| 12 | 
            +
              "dependencies": {
         | 
| 13 | 
            +
                "highlight.js": "^10.3.1",
         | 
| 14 | 
            +
                "json-schema-ref-parser": "^9.0.6",
         | 
| 15 | 
            +
                "json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
         | 
| 16 | 
            +
                "vuepress": "^1.7.1",
         | 
| 17 | 
            +
                "webpack-dev-middleware": "^3.6.0"
         | 
| 18 | 
            +
              },
         | 
| 19 | 
            +
              "devDependencies": {
         | 
| 20 | 
            +
                "braces": "^3.0.2",
         | 
| 21 | 
            +
                "dot-prop": "^5.3.0",
         | 
| 22 | 
            +
                "gh-pages": "^3.1.0",
         | 
| 23 | 
            +
                "js-yaml": "^3.14.0",
         | 
| 24 | 
            +
                "minimist": ">=1.2.3",
         | 
| 25 | 
            +
                "node-forge": ">=0.10.0",
         | 
| 26 | 
            +
                "serialize-javascript": "^5.0.1",
         | 
| 27 | 
            +
                "set-value": "^3.0.2",
         | 
| 28 | 
            +
                "yargs-parser": "^20.2.3"
         | 
| 29 | 
            +
              }
         | 
| 30 | 
            +
            }
         | 
| @@ -333,14 +333,14 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 333 333 | 
             
                  # get longitude from feature_location
         | 
| 334 334 | 
             
                  longitude = (feature_location.split(',')[1].delete! '[]').to_f
         | 
| 335 335 | 
             
                  # latitude
         | 
| 336 | 
            -
                  feature_report.location. | 
| 336 | 
            +
                  feature_report.location.latitude_deg = latitude
         | 
| 337 337 | 
             
                  # longitude
         | 
| 338 | 
            -
                  feature_report.location. | 
| 338 | 
            +
                  feature_report.location.longitude_deg = longitude
         | 
| 339 339 | 
             
                end
         | 
| 340 340 |  | 
| 341 341 | 
             
                # surface_elevation
         | 
| 342 342 | 
             
                elev = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='General' AND RowName='Elevation' AND ColumnName='Value'")
         | 
| 343 | 
            -
                feature_report.location. | 
| 343 | 
            +
                feature_report.location.surface_elevation_ft = elev
         | 
| 344 344 |  | 
| 345 345 | 
             
                ##########################################################################
         | 
| 346 346 | 
             
                ##
         | 
| @@ -350,18 +350,18 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 350 350 |  | 
| 351 351 | 
             
                # floor_area
         | 
| 352 352 | 
             
                floor_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Total Building Area' AND ColumnName='Area'")
         | 
| 353 | 
            -
                feature_report.program. | 
| 353 | 
            +
                feature_report.program.floor_area_sqft = convert_units(floor_area, 'm^2', 'ft^2')
         | 
| 354 354 |  | 
| 355 355 | 
             
                # conditioned_area
         | 
| 356 356 | 
             
                conditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Net Conditioned Building Area' AND ColumnName='Area'")
         | 
| 357 | 
            -
                feature_report.program. | 
| 357 | 
            +
                feature_report.program.conditioned_area_sqft = convert_units(conditioned_area, 'm^2', 'ft^2')
         | 
| 358 358 |  | 
| 359 359 | 
             
                # unconditioned_area
         | 
| 360 360 | 
             
                unconditioned_area = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Building Area' AND RowName='Unconditioned Building Area' AND ColumnName='Area'")
         | 
| 361 | 
            -
                feature_report.program. | 
| 361 | 
            +
                feature_report.program.unconditioned_area_sqft = convert_units(unconditioned_area, 'm^2', 'ft^2')
         | 
| 362 362 |  | 
| 363 363 | 
             
                # footprint_area
         | 
| 364 | 
            -
                feature_report.program. | 
| 364 | 
            +
                feature_report.program.footprint_area_sqft = convert_units(floor_area, 'm^2', 'ft^2')
         | 
| 365 365 |  | 
| 366 366 | 
             
                # maximum_number_of_stories
         | 
| 367 367 | 
             
                number_of_stories = building.standardsNumberOfStories.get if building.standardsNumberOfStories.is_initialized
         | 
| @@ -371,7 +371,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 371 371 | 
             
                # maximum_roof_height
         | 
| 372 372 | 
             
                floor_to_floor_height = building.nominalFloortoFloorHeight.to_f
         | 
| 373 373 | 
             
                maximum_roof_height = number_of_stories * floor_to_floor_height
         | 
| 374 | 
            -
                feature_report.program. | 
| 374 | 
            +
                feature_report.program.maximum_roof_height_ft = maximum_roof_height
         | 
| 375 375 |  | 
| 376 376 | 
             
                # maximum_number_of_stories_above_ground
         | 
| 377 377 | 
             
                number_of_stories_above_ground = building.standardsNumberOfAboveGroundStories.get if building.standardsNumberOfAboveGroundStories.is_initialized
         | 
| @@ -432,36 +432,36 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 432 432 | 
             
                ## window_area
         | 
| 433 433 | 
             
                # north_window_area
         | 
| 434 434 | 
             
                north_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='North (315 to 45 deg)'").to_f
         | 
| 435 | 
            -
                feature_report.program. | 
| 435 | 
            +
                feature_report.program.window_area_sqft[:north_window_area_sqft] = convert_units(north_window_area, 'm^2', 'ft^2')
         | 
| 436 436 | 
             
                # south_window_area
         | 
| 437 437 | 
             
                south_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='South (135 to 225 deg)'").to_f
         | 
| 438 | 
            -
                feature_report.program. | 
| 438 | 
            +
                feature_report.program.window_area_sqft[:south_window_area_sqft] = convert_units(south_window_area, 'm^2', 'ft^2')
         | 
| 439 439 | 
             
                # east_window_area
         | 
| 440 440 | 
             
                east_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='East (45 to 135 deg)'").to_f
         | 
| 441 | 
            -
                feature_report.program. | 
| 441 | 
            +
                feature_report.program.window_area_sqft[:east_window_area_sqft] = convert_units(east_window_area, 'm^2', 'ft^2')
         | 
| 442 442 | 
             
                # west_window_area
         | 
| 443 443 | 
             
                west_window_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Window Opening Area' AND ColumnName='West (225 to 315 deg)'").to_f
         | 
| 444 | 
            -
                feature_report.program. | 
| 444 | 
            +
                feature_report.program.window_area_sqft[:west_window_area_sqft] = convert_units(west_window_area, 'm^2', 'ft^2')
         | 
| 445 445 | 
             
                # total_window_area
         | 
| 446 446 | 
             
                total_window_area = north_window_area + south_window_area + east_window_area + west_window_area
         | 
| 447 | 
            -
                feature_report.program. | 
| 447 | 
            +
                feature_report.program.window_area_sqft[:total_window_area_sqft] = convert_units(total_window_area, 'm^2', 'ft^2')
         | 
| 448 448 |  | 
| 449 449 | 
             
                ## wall_area
         | 
| 450 450 | 
             
                # north_wall_area
         | 
| 451 451 | 
             
                north_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='North (315 to 45 deg)'").to_f
         | 
| 452 | 
            -
                feature_report.program. | 
| 452 | 
            +
                feature_report.program.wall_area_sqft[:north_wall_area_sqft] = convert_units(north_wall_area, 'm^2', 'ft^2')
         | 
| 453 453 | 
             
                # south_wall_area
         | 
| 454 454 | 
             
                south_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='South (135 to 225 deg)'").to_f
         | 
| 455 | 
            -
                feature_report.program. | 
| 455 | 
            +
                feature_report.program.wall_area_sqft[:south_wall_area_sqft] = convert_units(south_wall_area, 'm^2', 'ft^2')
         | 
| 456 456 | 
             
                # east_wall_area
         | 
| 457 457 | 
             
                east_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='East (45 to 135 deg)'").to_f
         | 
| 458 | 
            -
                feature_report.program. | 
| 458 | 
            +
                feature_report.program.wall_area_sqft[:east_wall_area_sqft] = convert_units(east_wall_area, 'm^2', 'ft^2')
         | 
| 459 459 | 
             
                # west_wall_area
         | 
| 460 460 | 
             
                west_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='West (225 to 315 deg)'").to_f
         | 
| 461 | 
            -
                feature_report.program. | 
| 461 | 
            +
                feature_report.program.wall_area_sqft[:west_wall_area_sqft] = convert_units(west_wall_area, 'm^2', 'ft^2')
         | 
| 462 462 | 
             
                # total_wall_area
         | 
| 463 463 | 
             
                total_wall_area = north_wall_area + south_wall_area + east_wall_area + west_wall_area
         | 
| 464 | 
            -
                feature_report.program. | 
| 464 | 
            +
                feature_report.program.wall_area_sqft[:total_wall_area_sqft] = convert_units(total_wall_area, 'm^2', 'ft^2')
         | 
| 465 465 |  | 
| 466 466 | 
             
                # total_roof_area
         | 
| 467 467 | 
             
                total_roof_area = 0.0
         | 
| @@ -470,12 +470,12 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 470 470 | 
             
                    total_roof_area += surface.netArea
         | 
| 471 471 | 
             
                  end
         | 
| 472 472 | 
             
                end
         | 
| 473 | 
            -
                feature_report.program. | 
| 473 | 
            +
                feature_report.program.roof_area_sqft[:total_roof_area_sqft] = convert_units(total_roof_area, 'm^2', 'ft^2')
         | 
| 474 474 |  | 
| 475 475 | 
             
                # orientation
         | 
| 476 476 | 
             
                # RK: a more robust method should be implemented to find orientation(finding main axis of the building using aspect ratio)
         | 
| 477 477 | 
             
                building_rotation = model.getBuilding.northAxis
         | 
| 478 | 
            -
                feature_report.program. | 
| 478 | 
            +
                feature_report.program.orientation_deg = building_rotation
         | 
| 479 479 |  | 
| 480 480 | 
             
                # aspect_ratio
         | 
| 481 481 | 
             
                north_wall_area = sql_query(runner, sql_file, 'InputVerificationandResultsSummary', "TableName='Window-Wall Ratio' AND RowName='Gross Wall Area' AND ColumnName='North (315 to 45 deg)'")
         | 
| @@ -486,7 +486,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 486 486 |  | 
| 487 487 | 
             
                # total_construction_cost
         | 
| 488 488 | 
             
                total_construction_cost = sql_query(runner, sql_file, 'Life-Cycle Cost Report', "TableName='Present Value for Recurring, Nonrecurring and Energy Costs (Before Tax)' AND RowName='LCC_MAT - BUILDING - LIFE CYCLE COSTS' AND ColumnName='Cost'")
         | 
| 489 | 
            -
                feature_report.program. | 
| 489 | 
            +
                feature_report.program.total_construction_cost_dollar = total_construction_cost
         | 
| 490 490 |  | 
| 491 491 | 
             
                # packaged thermal storage capacities by cooling coil
         | 
| 492 492 | 
             
                ptes_keys = sql_file.availableKeyValues('RUN Period 1', 'Zone Timestep', 'Cooling Coil Ice Thermal Storage End Fraction')
         | 
| @@ -504,7 +504,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 504 504 | 
             
                    runner.registerWarning('Query ptes_size.get failed')
         | 
| 505 505 | 
             
                  end
         | 
| 506 506 | 
             
                end
         | 
| 507 | 
            -
                feature_report.thermal_storage. | 
| 507 | 
            +
                feature_report.thermal_storage.ptes_size_kwh = ptes_size
         | 
| 508 508 |  | 
| 509 509 | 
             
                # get the central tank thermal storage capacity
         | 
| 510 510 | 
             
                its_size = nil
         | 
| @@ -519,7 +519,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 519 519 | 
             
                    runner.registerWarning('Query its_size.get failed')
         | 
| 520 520 | 
             
                  end
         | 
| 521 521 | 
             
                end
         | 
| 522 | 
            -
                feature_report.thermal_storage. | 
| 522 | 
            +
                feature_report.thermal_storage.its_size_kwh = its_size
         | 
| 523 523 |  | 
| 524 524 | 
             
                ############################################################################
         | 
| 525 525 | 
             
                ##
         | 
| @@ -550,48 +550,48 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 550 550 |  | 
| 551 551 | 
             
                # total_site_energy
         | 
| 552 552 | 
             
                total_site_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Total Site Energy' AND ColumnName='Total Energy'")
         | 
| 553 | 
            -
                feature_report.reporting_periods[0]. | 
| 553 | 
            +
                feature_report.reporting_periods[0].total_site_energy_kwh = convert_units(total_site_energy, 'GJ', 'kWh')
         | 
| 554 554 |  | 
| 555 555 | 
             
                # total_source_energy
         | 
| 556 556 | 
             
                total_source_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Total Source Energy' AND ColumnName='Total Energy'")
         | 
| 557 | 
            -
                feature_report.reporting_periods[0]. | 
| 557 | 
            +
                feature_report.reporting_periods[0].total_source_energy_kwh = convert_units(total_source_energy, 'GJ', 'kWh')
         | 
| 558 558 |  | 
| 559 559 | 
             
                # net_site_energy
         | 
| 560 560 | 
             
                net_site_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Net Site Energy' AND ColumnName='Total Energy'")
         | 
| 561 | 
            -
                feature_report.reporting_periods[0]. | 
| 561 | 
            +
                feature_report.reporting_periods[0].net_site_energy_kwh = convert_units(net_site_energy, 'GJ', 'kWh')
         | 
| 562 562 |  | 
| 563 563 | 
             
                # net_source_energy
         | 
| 564 564 | 
             
                net_source_energy = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Site and Source Energy' AND RowName='Net Source Energy' AND ColumnName='Total Energy'")
         | 
| 565 | 
            -
                feature_report.reporting_periods[0]. | 
| 565 | 
            +
                feature_report.reporting_periods[0].net_source_energy_kwh = convert_units(net_source_energy, 'GJ', 'kWh')
         | 
| 566 566 |  | 
| 567 567 | 
             
                # electricity
         | 
| 568 568 | 
             
                electricity = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Electricity'")
         | 
| 569 | 
            -
                feature_report.reporting_periods[0]. | 
| 569 | 
            +
                feature_report.reporting_periods[0].electricity_kwh = convert_units(electricity, 'GJ', 'kWh')
         | 
| 570 570 |  | 
| 571 571 | 
             
                # natural_gas
         | 
| 572 572 | 
             
                natural_gas = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Natural Gas'")
         | 
| 573 | 
            -
                feature_report.reporting_periods[0]. | 
| 573 | 
            +
                feature_report.reporting_periods[0].natural_gas_kwh = convert_units(natural_gas, 'GJ', 'kWh')
         | 
| 574 574 |  | 
| 575 575 | 
             
                # additional_fuel
         | 
| 576 576 | 
             
                additional_fuel = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Additional Fuel'")
         | 
| 577 | 
            -
                feature_report.reporting_periods[0]. | 
| 577 | 
            +
                feature_report.reporting_periods[0].additional_fuel_kwh = convert_units(additional_fuel, 'GJ', 'kWh')
         | 
| 578 578 |  | 
| 579 579 | 
             
                # district_cooling
         | 
| 580 580 | 
             
                district_cooling = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Cooling'")
         | 
| 581 | 
            -
                feature_report.reporting_periods[0]. | 
| 581 | 
            +
                feature_report.reporting_periods[0].district_cooling_kwh = convert_units(district_cooling, 'GJ', 'kWh')
         | 
| 582 582 |  | 
| 583 583 | 
             
                # district_heating
         | 
| 584 584 | 
             
                district_heating = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='District Heating'")
         | 
| 585 | 
            -
                feature_report.reporting_periods[0]. | 
| 585 | 
            +
                feature_report.reporting_periods[0].district_heating_kwh = convert_units(district_heating, 'GJ', 'kWh')
         | 
| 586 586 |  | 
| 587 587 | 
             
                # water
         | 
| 588 588 | 
             
                water = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='Total End Uses' AND ColumnName='Water'")
         | 
| 589 589 | 
             
                # feature_report.reporting_periods[0].water = convert_units(water, 'm3', 'ft3')
         | 
| 590 | 
            -
                feature_report.reporting_periods[0]. | 
| 590 | 
            +
                feature_report.reporting_periods[0].water_qbft = water
         | 
| 591 591 |  | 
| 592 592 | 
             
                # electricity_produced
         | 
| 593 593 | 
             
                electricity_produced = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Total On-Site and Utility Electric Sources' AND ColumnName='Electricity'")
         | 
| 594 | 
            -
                feature_report.reporting_periods[0]. | 
| 594 | 
            +
                feature_report.reporting_periods[0].electricity_produced_kwh = convert_units(electricity_produced, 'GJ', 'kWh')
         | 
| 595 595 |  | 
| 596 596 | 
             
                ## end_uses
         | 
| 597 597 |  | 
| @@ -610,17 +610,26 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 610 610 | 
             
                    # report each query in its corresponding feature report obeject
         | 
| 611 611 | 
             
                    if ft.include? ' '
         | 
| 612 612 | 
             
                      x = ft.tr(' ', '_').downcase
         | 
| 613 | 
            -
                       | 
| 613 | 
            +
                      if x.include? 'water'
         | 
| 614 | 
            +
                        x_u = x + '_qbft'
         | 
| 615 | 
            +
                      else
         | 
| 616 | 
            +
                        x_u = x + '_kwh'
         | 
| 617 | 
            +
                      end
         | 
| 618 | 
            +
                      m = feature_report.reporting_periods[0].end_uses.send(x_u)
         | 
| 614 619 | 
             
                    else
         | 
| 615 | 
            -
                       | 
| 616 | 
            -
             | 
| 620 | 
            +
                      if ft.downcase.include? 'water'
         | 
| 621 | 
            +
                        ft_u = ft + '_qbft'
         | 
| 622 | 
            +
                      else
         | 
| 623 | 
            +
                        ft_u = ft + '_kwh'
         | 
| 624 | 
            +
                      end
         | 
| 625 | 
            +
                      m = feature_report.reporting_periods[0].end_uses.send(ft_u.downcase)
         | 
| 617 626 | 
             
                    end
         | 
| 618 627 |  | 
| 619 628 | 
             
                    if eu.include? ' '
         | 
| 620 629 | 
             
                      y = eu.tr(' ', '_').downcase
         | 
| 621 | 
            -
                      m.send("#{y}=", convert_units(sql_r, 'GJ', ' | 
| 630 | 
            +
                      m.send("#{y}=", convert_units(sql_r, 'GJ', 'kWh'))
         | 
| 622 631 | 
             
                    else
         | 
| 623 | 
            -
                      m.send("#{eu.downcase}=", convert_units(sql_r, 'GJ', ' | 
| 632 | 
            +
                      m.send("#{eu.downcase}=", convert_units(sql_r, 'GJ', 'kWh'))
         | 
| 624 633 | 
             
                    end
         | 
| 625 634 | 
             
                  end
         | 
| 626 635 | 
             
                end
         | 
| @@ -629,20 +638,20 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure | |
| 629 638 | 
             
                ## electricity_produced
         | 
| 630 639 | 
             
                # photovoltaic
         | 
| 631 640 | 
             
                photovoltaic_power = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='Electric Loads Satisfied' AND RowName='Photovoltaic Power' AND ColumnName='Electricity'")
         | 
| 632 | 
            -
                feature_report.reporting_periods[0]. | 
| 641 | 
            +
                feature_report.reporting_periods[0].energy_production_kwh[:electricity_produced][:photovoltaic] = convert_units(photovoltaic_power, 'GJ', 'kWh')
         | 
| 633 642 |  | 
| 634 643 | 
             
                ## Total utility cost
         | 
| 635 644 | 
             
                total_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Total'")
         | 
| 636 | 
            -
                feature_report.reporting_periods[0]. | 
| 645 | 
            +
                feature_report.reporting_periods[0].total_utility_cost_dollar = total_utility_cost
         | 
| 637 646 |  | 
| 638 647 | 
             
                ## Utility Costs
         | 
| 639 648 | 
             
                # electricity utility cost
         | 
| 640 649 | 
             
                elec_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Electric'")
         | 
| 641 | 
            -
                feature_report.reporting_periods[0]. | 
| 642 | 
            -
                feature_report.reporting_periods[0]. | 
| 650 | 
            +
                feature_report.reporting_periods[0].utility_costs_dollar[0][:fuel_type] = 'Electricity'
         | 
| 651 | 
            +
                feature_report.reporting_periods[0].utility_costs_dollar[0][:total_cost] = elec_utility_cost
         | 
| 643 652 | 
             
                # gas utility cost
         | 
| 644 653 | 
             
                gas_utility_cost = sql_query(runner, sql_file, 'Economics Results Summary Report', "TableName='Annual Cost' AND RowName='Cost' AND ColumnName='Gas'")
         | 
| 645 | 
            -
                feature_report.reporting_periods[0]. | 
| 654 | 
            +
                feature_report.reporting_periods[0].utility_costs_dollar << { fuel_type: 'Natural Gas', total_cost: gas_utility_cost }
         | 
| 646 655 |  | 
| 647 656 | 
             
                ## comfort_result
         | 
| 648 657 | 
             
                # time_setpoint_not_met_during_occupied_cooling
         | 
| @@ -39,10 +39,10 @@ module URBANopt | |
| 39 39 | 
             
                  # Enduses class inlclude results for each fuel type.
         | 
| 40 40 | 
             
                  ##
         | 
| 41 41 | 
             
                  class EndUses
         | 
| 42 | 
            -
                    attr_accessor : | 
| 42 | 
            +
                    attr_accessor :electricity_kwh, :natural_gas_kwh, :additional_fuel_kwh, :district_cooling_kwh, :district_heating_kwh, :water_qbft # :nodoc:
         | 
| 43 43 | 
             
                    ##
         | 
| 44 | 
            -
                    # EndUses class intialize end_uses(fuel type) attributes: +: | 
| 45 | 
            -
                    # +: | 
| 44 | 
            +
                    # EndUses class intialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:additional_fuel_kwh+ ,
         | 
| 45 | 
            +
                    # +:district_cooling_kwh+ , +:district_heating_kwh+ , +:water_qbft+
         | 
| 46 46 | 
             
                    ##
         | 
| 47 47 | 
             
                    # [parameters:]
         | 
| 48 48 | 
             
                    # +hash+ - _Hash_ - A hash which may contain a deserialized end_uses.
         | 
| @@ -51,12 +51,12 @@ module URBANopt | |
| 51 51 | 
             
                      hash.delete_if { |k, v| v.nil? }
         | 
| 52 52 | 
             
                      hash = defaults.merge(hash)
         | 
| 53 53 |  | 
| 54 | 
            -
                      @ | 
| 55 | 
            -
                      @ | 
| 56 | 
            -
                      @ | 
| 57 | 
            -
                      @ | 
| 58 | 
            -
                      @ | 
| 59 | 
            -
                      @ | 
| 54 | 
            +
                      @electricity_kwh = EndUse.new(hash[:electricity_kwh])
         | 
| 55 | 
            +
                      @natural_gas_kwh = EndUse.new(hash[:natural_gas_kwh])
         | 
| 56 | 
            +
                      @additional_fuel_kwh = EndUse.new(hash[:additional_fuel_kwh])
         | 
| 57 | 
            +
                      @district_cooling_kwh = EndUse.new(hash[:district_cooling_kwh])
         | 
| 58 | 
            +
                      @district_heating_kwh = EndUse.new(hash[:district_heating_kwh])
         | 
| 59 | 
            +
                      @water_qbft = EndUse.new(hash[:water_qbft])
         | 
| 60 60 |  | 
| 61 61 | 
             
                      # initialize class variables @@validator and @@schema
         | 
| 62 62 | 
             
                      @@validator ||= Validator.new
         | 
| @@ -72,29 +72,29 @@ module URBANopt | |
| 72 72 | 
             
                    def to_hash
         | 
| 73 73 | 
             
                      result = {}
         | 
| 74 74 |  | 
| 75 | 
            -
                       | 
| 76 | 
            -
                       | 
| 77 | 
            -
                      result[: | 
| 75 | 
            +
                      electricity_kwh_hash = @electricity_kwh.to_hash if @electricity_kwh.to_hash
         | 
| 76 | 
            +
                      electricity_kwh_hash.delete_if { |k, v| v.nil? }
         | 
| 77 | 
            +
                      result[:electricity_kwh] = electricity_kwh_hash if @electricity_kwh
         | 
| 78 78 |  | 
| 79 | 
            -
                       | 
| 80 | 
            -
                       | 
| 81 | 
            -
                      result[: | 
| 79 | 
            +
                      natural_gas_kwh_hash = @natural_gas_kwh.to_hash if @natural_gas_kwh
         | 
| 80 | 
            +
                      natural_gas_kwh_hash.delete_if { |k, v| v.nil? }
         | 
| 81 | 
            +
                      result[:natural_gas_kwh] = natural_gas_kwh_hash if @natural_gas_kwh
         | 
| 82 82 |  | 
| 83 | 
            -
                       | 
| 84 | 
            -
                       | 
| 85 | 
            -
                      result[: | 
| 83 | 
            +
                      additional_fuel_kwh_hash = @additional_fuel_kwh.to_hash if @additional_fuel_kwh
         | 
| 84 | 
            +
                      additional_fuel_kwh_hash.delete_if { |k, v| v.nil? }
         | 
| 85 | 
            +
                      result[:additional_fuel_kwh] = additional_fuel_kwh_hash if @additional_fuel_kwh
         | 
| 86 86 |  | 
| 87 | 
            -
                       | 
| 88 | 
            -
                       | 
| 89 | 
            -
                      result[: | 
| 87 | 
            +
                      district_cooling_kwh_hash = @district_cooling_kwh.to_hash if @district_cooling_kwh
         | 
| 88 | 
            +
                      district_cooling_kwh_hash.delete_if { |k, v| v.nil? }
         | 
| 89 | 
            +
                      result[:district_cooling_kwh] = district_cooling_kwh_hash if @district_cooling_kwh
         | 
| 90 90 |  | 
| 91 | 
            -
                       | 
| 92 | 
            -
                       | 
| 93 | 
            -
                      result[: | 
| 91 | 
            +
                      district_heating_kwh_hash = @district_heating_kwh.to_hash if @district_heating_kwh
         | 
| 92 | 
            +
                      district_heating_kwh_hash.delete_if { |k, v| v.nil? }
         | 
| 93 | 
            +
                      result[:district_heating_kwh] = district_heating_kwh_hash if @district_heating_kwh
         | 
| 94 94 |  | 
| 95 | 
            -
                       | 
| 96 | 
            -
                       | 
| 97 | 
            -
                      result[: | 
| 95 | 
            +
                      water_qbft_hash = @water_qbft.to_hash if @water_qbft
         | 
| 96 | 
            +
                      water_qbft_hash.delete_if { |k, v| v.nil? }
         | 
| 97 | 
            +
                      result[:water_qbft] = water_qbft_hash if @water_qbft
         | 
| 98 98 |  | 
| 99 99 | 
             
                      # validate end_uses properties against schema
         | 
| 100 100 | 
             
                      if @@validator.validate(@@schema[:definitions][:EndUses][:properties], result).any?
         | 
| @@ -109,12 +109,12 @@ module URBANopt | |
| 109 109 | 
             
                    ##
         | 
| 110 110 | 
             
                    def defaults
         | 
| 111 111 | 
             
                      hash = {}
         | 
| 112 | 
            -
                      hash[: | 
| 113 | 
            -
                      hash[: | 
| 114 | 
            -
                      hash[: | 
| 115 | 
            -
                      hash[: | 
| 116 | 
            -
                      hash[: | 
| 117 | 
            -
                      hash[: | 
| 112 | 
            +
                      hash[:electricity_kwh] = EndUse.new.to_hash
         | 
| 113 | 
            +
                      hash[:natural_gas_kwh] = EndUse.new.to_hash
         | 
| 114 | 
            +
                      hash[:additional_fuel_kwh] = EndUse.new.to_hash
         | 
| 115 | 
            +
                      hash[:district_cooling_kwh] = EndUse.new.to_hash
         | 
| 116 | 
            +
                      hash[:district_heating_kwh] = EndUse.new.to_hash
         | 
| 117 | 
            +
                      hash[:water_qbft] = EndUse.new.to_hash
         | 
| 118 118 |  | 
| 119 119 | 
             
                      return hash
         | 
| 120 120 | 
             
                    end
         | 
| @@ -127,11 +127,11 @@ module URBANopt | |
| 127 127 | 
             
                    ##
         | 
| 128 128 | 
             
                    def merge_end_uses!(new_end_uses)
         | 
| 129 129 | 
             
                      # modify the existing_period by summing up the results ; # sum results only if they exist
         | 
| 130 | 
            -
                      @ | 
| 131 | 
            -
                      @ | 
| 132 | 
            -
                      @ | 
| 133 | 
            -
                      @ | 
| 134 | 
            -
                      @ | 
| 130 | 
            +
                      @electricity_kwh.merge_end_use!(new_end_uses.electricity_kwh)
         | 
| 131 | 
            +
                      @natural_gas_kwh.merge_end_use!(new_end_uses.natural_gas_kwh)
         | 
| 132 | 
            +
                      @additional_fuel_kwh.merge_end_use!(new_end_uses.additional_fuel_kwh)
         | 
| 133 | 
            +
                      @district_cooling_kwh.merge_end_use!(new_end_uses.district_cooling_kwh)
         | 
| 134 | 
            +
                      @district_heating_kwh.merge_end_use!(new_end_uses.district_heating_kwh)
         | 
| 135 135 | 
             
                      return self
         | 
| 136 136 | 
             
                    end
         | 
| 137 137 | 
             
                  end
         | 
| @@ -224,30 +224,24 @@ module URBANopt | |
| 224 224 | 
             
                    end
         | 
| 225 225 |  | 
| 226 226 | 
             
                    ##
         | 
| 227 | 
            -
                    # Saves the 'default_feature_report.json'  | 
| 227 | 
            +
                    # Saves the 'default_feature_report.json' file to the results directory
         | 
| 228 228 | 
             
                    ##
         | 
| 229 229 | 
             
                    # [parameters]:
         | 
| 230 | 
            -
                    # +file_name+ - _String_ - Assign a name to the saved feature report  | 
| 231 | 
            -
                    def  | 
| 230 | 
            +
                    # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
         | 
| 231 | 
            +
                    def save_json_report(file_name = 'default_feature_report')
         | 
| 232 232 | 
             
                      # reassign the initialize local variable @file_name to the file name input.
         | 
| 233 233 | 
             
                      @file_name = file_name
         | 
| 234 234 |  | 
| 235 | 
            +
                      # define the results_dir_path
         | 
| 236 | 
            +
                      results_dir_path = File.join(@directory_name, 'feature_reports')
         | 
| 235 237 | 
             
                      # create feature reports directory
         | 
| 236 | 
            -
                      Dir.mkdir( | 
| 237 | 
            -
             | 
| 238 | 
            -
                      # save the csv data
         | 
| 239 | 
            -
                      old_timeseries_path = nil
         | 
| 240 | 
            -
                      if !@timeseries_csv.path.nil?
         | 
| 241 | 
            -
                        old_timeseries_path = @timeseries_csv.path
         | 
| 242 | 
            -
                      end
         | 
| 243 | 
            -
             | 
| 244 | 
            -
                      @timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
         | 
| 245 | 
            -
                      @timeseries_csv.save_data
         | 
| 238 | 
            +
                      Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
         | 
| 246 239 |  | 
| 240 | 
            +
                      ## save json rport
         | 
| 247 241 | 
             
                      # feature_hash
         | 
| 248 242 | 
             
                      feature_hash = to_hash
         | 
| 249 243 |  | 
| 250 | 
            -
                      json_name_path = File.join( | 
| 244 | 
            +
                      json_name_path = File.join(results_dir_path, file_name + '.json')
         | 
| 251 245 |  | 
| 252 246 | 
             
                      File.open(json_name_path, 'w') do |f|
         | 
| 253 247 | 
             
                        f.puts JSON.pretty_generate(feature_hash)
         | 
| @@ -259,13 +253,35 @@ module URBANopt | |
| 259 253 | 
             
                        end
         | 
| 260 254 | 
             
                      end
         | 
| 261 255 |  | 
| 262 | 
            -
             | 
| 263 | 
            -
             | 
| 264 | 
            -
             | 
| 265 | 
            -
             | 
| 256 | 
            +
                    end
         | 
| 257 | 
            +
             | 
| 258 | 
            +
                    ##
         | 
| 259 | 
            +
                    # Saves the 'default_feature_report.csv' file to the results directory
         | 
| 260 | 
            +
                    ##
         | 
| 261 | 
            +
                    # [parameters]:
         | 
| 262 | 
            +
                    # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
         | 
| 263 | 
            +
                    def save_csv_report(file_name = 'default_feature_report')
         | 
| 264 | 
            +
                      # reassign the initialize local variable @file_name to the file name input.
         | 
| 265 | 
            +
                      @file_name = file_name
         | 
| 266 | 
            +
             | 
| 267 | 
            +
                      # define the results_dir_path
         | 
| 268 | 
            +
                      results_dir_path = File.join(@directory_name, 'feature_reports')
         | 
| 269 | 
            +
                      # create feature reports directory
         | 
| 270 | 
            +
                      Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
         | 
| 271 | 
            +
             | 
| 272 | 
            +
                      ## copy CSV report to the new feature_reports folder
         | 
| 273 | 
            +
                      # get all folder names in the feature diectory
         | 
| 274 | 
            +
                      directory_folders = Dir.glob "#{@directory_name}/*/"
         | 
| 275 | 
            +
                      # copy the CSV report to the new feature_reports folder
         | 
| 276 | 
            +
                      directory_folders.each do |f|
         | 
| 277 | 
            +
                        if f.include? '_default_feature_reports'
         | 
| 278 | 
            +
                          FileUtils.cp(File.join(f, 'default_feature_reports.csv'), File.join(results_dir_path, @file_name +'.csv'))
         | 
| 279 | 
            +
                        end
         | 
| 266 280 | 
             
                      end
         | 
| 267 | 
            -
                      return true
         | 
| 268 281 | 
             
                    end
         | 
| 282 | 
            +
             | 
| 283 | 
            +
             | 
| 284 | 
            +
             | 
| 269 285 | 
             
                  end
         | 
| 270 286 | 
             
                end
         | 
| 271 287 | 
             
              end
         |