Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Residential: connect to ResStock #190

Merged
merged 102 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
00acd3d
point to os37-rc2 in CI, and remove old comments
vtnate Nov 13, 2023
91746ec
start with local branches with newer dependencies
vtnate Nov 13, 2023
d90788a
Merge commit 'da0ad127a4c506fe70c078224fc18cf711b70181' into os37
vtnate Nov 13, 2023
da0ad12
Squashed 'example_project/resources/hpxml-measures/' changes from e2f…
vtnate Nov 13, 2023
410b645
get new error message in baseline mapper from cli code
vtnate Nov 13, 2023
f33b774
openstudio:update_measures which just added license text
vtnate Nov 13, 2023
0fb5b8e
point to branches to test OS3.7
vtnate Nov 20, 2023
29a5b7d
also specify core-gem in this repo, at least during testing
vtnate Nov 20, 2023
7b74925
use official OS version 3.7.0 in CI
vtnate Nov 20, 2023
31ec325
Squashed 'example_project/resources/hpxml-measures/' changes from d74…
vtnate Nov 20, 2023
c829f41
Merge commit '31ec325904a8cc59a471301c643c124327e49694' into os37
vtnate Nov 20, 2023
c080412
update BuildResidentialModel measure
vtnate Nov 20, 2023
f0616d8
change building location even for osm buildings
vtnate Nov 30, 2023
2794d20
remove hardcoded local weatherfile path from osm buildings
vtnate Nov 30, 2023
2aff9bb
Update to OS-HPXML v1.7.0 (#189)
joseph-robertson Dec 1, 2023
5414635
add chilled_water_storage to <run/process/clear/visualize>_all rake t…
vtnate Dec 1, 2023
f2876df
Merge commit 'fb89687bd040f030435ed61e618624d874f714db' as 'example_p…
joseph-robertson Dec 4, 2023
fb89687
Squashed 'example_project/resources/resstock/' content from commit 18…
joseph-robertson Dec 4, 2023
90ffc88
Stub switch between template and resstock in mapper.
joseph-robertson Dec 4, 2023
d215d11
Remove hpxml-measures since resstock has it.
joseph-robertson Dec 4, 2023
552c78b
Squashed 'example_project/resources/resstock/' changes from 18ff4bf38…
joseph-robertson Dec 4, 2023
cc1a9bc
Merge commit '552c78b9c2e883bbc9d1fdcb93f40040c8c61baa' into resstock…
joseph-robertson Dec 4, 2023
9345205
Copy some buildexistingmodel code into buildresidential model.
joseph-robertson Dec 4, 2023
1da6608
point to davids os37-rc branch of load-flex-gem
vtnate Dec 8, 2023
181fb3f
fix license link in copyright notice
vtnate Dec 8, 2023
e134a73
adding geometry orientation and aspect ratio example for single-famil…
kflemin Dec 8, 2023
006c99b
Major refactor into general residential mapping, template mapping, an…
joseph-robertson Dec 12, 2023
394a6c9
Change building_id argument name to resstock_building_id for clarity.
joseph-robertson Dec 12, 2023
2b15c0c
Add update_residential task to rakefile.
joseph-robertson Dec 12, 2023
41c4b9f
Update new rake task to use git clone with a depth of 1.
joseph-robertson Dec 12, 2023
f7eb94b
Adjust rake task based on what is required.
joseph-robertson Dec 12, 2023
9c79e09
Add back accidental folder removal.
joseph-robertson Dec 12, 2023
bc95d6b
Remove residential-measures folder.
joseph-robertson Dec 12, 2023
568667a
Re-add residential-measures without submodule.
joseph-robertson Dec 12, 2023
a8d5872
Rename the residential_resstock method to residential_samples.
joseph-robertson Dec 13, 2023
a273256
Merge branch 'os37' into resstock-connection
joseph-robertson Dec 13, 2023
6aec0ab
updating openstudio measure gems versions
kflemin Dec 15, 2023
20865e1
use newly released version of openstudio-geb-gem
vtnate Dec 15, 2023
6aedc6d
allow allow_local to work again
vtnate Dec 18, 2023
ddfdc00
use http in example project_dir gemfile, to help installer
vtnate Dec 21, 2023
38b32fe
point gemfiles to develop branches of openstudio gems
vtnate Dec 21, 2023
a3879ea
use http://rubygems.org in gemfile
vtnate Dec 21, 2023
b04b5ce
Residential: add unit tests for BuildResidentialModel (#191)
joseph-robertson Dec 21, 2023
30484a7
Merge branch 'os37' into resstock-connection
joseph-robertson Dec 21, 2023
72b0f0f
Run update_resources.
joseph-robertson Dec 21, 2023
06ab015
Update test file for feature_id name change.
joseph-robertson Dec 21, 2023
9f4629d
Update another feature_id name change.
joseph-robertson Dec 21, 2023
b8e3c11
Add a test for buildstock csv path with resstock building ids.
joseph-robertson Dec 21, 2023
4e72e90
Remove gitignore from resstock so we get os-hpxml data files.
joseph-robertson Jan 8, 2024
e139e0c
Merge branch 'develop' into resstock-connection
joseph-robertson Jan 23, 2024
33c7aa4
Fix merge conflicts.
joseph-robertson Jan 23, 2024
7be002a
Fix more merge conflicts.
joseph-robertson Jan 23, 2024
0c7582b
Added initial framework for uo_resstock connection: (1) updated Gemf…
rawadelkontar Feb 11, 2024
8a4fbc7
added example buildstock.csv for baltimore area to test
rawadelkontar Feb 11, 2024
0f345ff
updated matching algorithm to accurately find a match, added buildsto…
rawadelkontar Feb 13, 2024
816125f
deleted testing unwanted buildstock file and updated the gejson file
rawadelkontar Feb 13, 2024
9e6126f
added mapping to SFA number of units
rawadelkontar Feb 15, 2024
1fc26bc
saved a match_log file
rawadelkontar Feb 15, 2024
eeec444
changed lof match file name to uo_buildstock_match_log.csv
rawadelkontar Feb 15, 2024
2afa1fb
Added workflow to get matching building buildstock id from user inpu…
rawadelkontar Feb 16, 2024
97d7a47
added the example uo_buildstock_mapping.csv input file
rawadelkontar Feb 16, 2024
f0e75f7
Assign resstock buildstock csv path at feature level.
joseph-robertson Feb 19, 2024
dc1c61a
Move all resstock connection methods into util file.
joseph-robertson Feb 19, 2024
b1937cf
Test all resstock connection methods using unit tests.
joseph-robertson Feb 19, 2024
a96e794
Remove commented line.
joseph-robertson Feb 19, 2024
1947e18
Add unit test and error catching in build measure.
joseph-robertson Feb 20, 2024
f1696a7
Set a random seed on matches so we can reproduce results.
joseph-robertson Feb 29, 2024
562a756
Decided that resstock units are identical within a building.
joseph-robertson Feb 29, 2024
b3dab5f
Merge branch 'develop' into resstock-connection
joseph-robertson Mar 1, 2024
ced5cd7
Merge branch 'resstock-connection' into resstock-connection-refactor
joseph-robertson Mar 1, 2024
6861591
Merge pull request #193 from urbanopt/resstock-connection-refactor
joseph-robertson Mar 4, 2024
417c008
Ignore more resstock arguments.
joseph-robertson Mar 7, 2024
8393d81
Improve comments around location assignments.
joseph-robertson Mar 7, 2024
0b8901d
Clean up baseline mapper and samples util.
joseph-robertson Mar 7, 2024
314647c
Add unit test for when uo_buildstock_mapping_csv_path is specified.
joseph-robertson Mar 7, 2024
698d8cc
Sleep 2.
joseph-robertson Mar 7, 2024
4f91856
Test all features listed in uo_buildstock_mapping_csv_path.
joseph-robertson Mar 7, 2024
fb2b485
Clean up project baseline scenario and combined json.
joseph-robertson Mar 11, 2024
18cd2f2
Updates for year built and supporting units < floors.
joseph-robertson Mar 11, 2024
ab4568e
Update xml building feature 17 for weather path.
joseph-robertson Mar 12, 2024
dbe9fa6
Fix and update hvac mapping for general residential.
joseph-robertson Mar 12, 2024
46e9d0e
Add asserts on hpxml_path in residential test file.
joseph-robertson Mar 12, 2024
387372a
Updates for HPXML constant, software program, and apply_defaults.
joseph-robertson Mar 13, 2024
556fa08
Remove need for buildstock_csv_path when uo_mapping_csv_path is present.
joseph-robertson May 21, 2024
bc1a20a
Clean up baseline mapper.
joseph-robertson May 21, 2024
5c6c798
Add new method for downselecting either buildstock_csv_path or uo_map…
joseph-robertson May 21, 2024
5fdf233
Update uo_mapping_csv_path test to point to a subset of parameters.
joseph-robertson May 21, 2024
8e9bb5f
Update measure to handle a subset of parameters specified.
joseph-robertson May 21, 2024
395e31f
Improve comments in baseline mapper.
joseph-robertson May 23, 2024
19225b5
Remove lighting parameter from test uo mapping csv file.
joseph-robertson May 23, 2024
d0795cd
Update residential measure to use defaults where missing parameters d…
joseph-robertson May 23, 2024
464616c
Remove all lib folder stuff, and clean up methods and comments.
joseph-robertson May 30, 2024
aae58fc
Progress on unit tests for comparing hpxml files.
joseph-robertson May 31, 2024
fa9e1bd
Add maps for HVAC and occupants.
joseph-robertson Jun 3, 2024
919580f
Update tests for checking ducts.
joseph-robertson Jun 3, 2024
dcd932e
Tighten up mapping and tests.
joseph-robertson Jun 4, 2024
54891c2
Run residential:update_resources and overwrite all copywrite headers.
joseph-robertson Jun 25, 2024
a674277
use current versions of UO gems
vtnate Jun 27, 2024
b4856ae
Merge branch 'develop' into resstock-connection
vtnate Jun 27, 2024
a093196
allow on-demand running of CI
vtnate Jun 27, 2024
0e7db7f
add newline before output of each rake task
vtnate Jun 28, 2024
84e3ab3
update UO gem versions, and temporarily do not favor_local_gems (unti…
vtnate Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ runner.conf
.coveralls.yml

example_project/measures/BuildResidentialModel/tests/run
example_project/measures/BuildResidentialModel/tests/samples/precomputed
example_project/resources/residential-measures/weather
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ else
gem 'urbanopt-reporting', '~> 0.9.1'
end

if allow_local && File.exist?('../urbanopt-geojson-gem')
gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
elsif allow_local
gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
else
gem 'urbanopt-geojson', '~> 0.11.1'
end
#if allow_local && File.exist?('../urbanopt-geojson-gem')
# gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
#elsif allow_local
gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'uo-resstock_connection'
#else
# gem 'urbanopt-geojson', '~> 0.11.1'
#end

if allow_local && File.exist?('../urbanopt-reopt-gem')
gem 'urbanopt-reopt', path: '../urbanopt-reopt-gem'
Expand Down
25 changes: 22 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,31 @@ desc 'Run residential tasks'
namespace :residential do
desc 'Update residential resources'
task :update_resources do
prefix = 'example_project/resources/hpxml-measures'
repository = 'https://github.com/NREL/OpenStudio-HPXML.git'
branch_or_tag = 'v1.7.0' # update this when pulling in updated OS-HPXML
prefix = 'example_project/resources/residential-measures'
repository = 'https://github.com/NREL/resstock.git'
branch_or_tag = 'v3.2.0' # update this when pulling in updated ResStock

FileUtils.rm_rf(prefix)
system("git clone --depth 1 --branch #{branch_or_tag} #{repository} #{prefix}")

folders_to_remove = [
'.git',
'.github',
'.gitignore',
'docs',
'project_testing',
'resources/data',
'test/base_results/baseline/timeseries',
'test/base_results/upgrades',
'test/SetSpaceInfiltrationPerExteriorArea',
'test/tests_buildstock_csvs',
'test/tests_housing_characteristics',
'test/tests_yml_files'
]

folders_to_remove.each do |f|
FileUtils.rm_rf(File.join(prefix, f))
end
end

desc 'Run residential measure tests'
Expand Down
14 changes: 7 additions & 7 deletions example_project/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ else
gem 'openstudio-geb', '~> 0.4.0'
end

if allow_local && File.exists?('../urbanopt-geojson-gem')
gem 'urbanopt-geojson', path: '../../urbanopt-geojson-gem'
elsif allow_local
gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
else
gem 'urbanopt-geojson', '~> 0.11.1'
end
#if allow_local && File.exists?('../urbanopt-geojson-gem')
# gem 'urbanopt-geojson', path: '../../urbanopt-geojson-gem'
#elsif allow_local
gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'uo-resstock_connection'
#else
# gem 'urbanopt-geojson', '~> 0.11.1'
#end

# NEVER put SCENARIO-GEM in this file...it will make all simulations fail due to the sqlite dependency
# gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
Expand Down
17 changes: 10 additions & 7 deletions example_project/example_project_combined.json
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@
"onsite_parking_fraction": 1,
"template": "Residential IECC 2015 - Customizable Template Sep 2020",
"geometry_unit_orientation": 90.0,
"geometry_unit_aspect_ratio" : 1.0
"geometry_unit_aspect_ratio": 1.0
},
"geometry": {
"type": "Polygon",
Expand Down Expand Up @@ -699,7 +699,9 @@
"roof_type": "Hip",
"system_type": "Residential - boiler and room air conditioner",
"heating_system_fuel_type": "propane",
"template": "Residential IECC 2015 - Customizable Template Sep 2020"
"year_built": 1986,
"characterize_residential_buildings_from_buildstock_csv": true,
"uo_buildstock_mapping_csv_path": "resources/uo_buildstock_mapping.csv"
},
"geometry": {
"type": "Polygon",
Expand Down Expand Up @@ -833,17 +835,18 @@
"name": "Residential 5",
"type": "Building",
"building_type": "Multifamily",
"floor_area": 28636,
"footprint_area": 14318,
"floor_area": 10000,
"footprint_area": 5000,
"number_of_stories_above_ground": 2,
"number_of_stories": 2,
"number_of_bedrooms": 16,
"foundation_type": "slab",
"attic_type": "flat roof",
"system_type": "Residential - furnace and room air conditioner",
"heating_system_fuel_type": "wood",
"system_type": "Residential - furnace and central air conditioner",
"heating_system_fuel_type": "electricity",
"number_of_residential_units": 8,
"template": "Residential IECC 2015 - Customizable Template Sep 2020"
"characterize_residential_buildings_from_buildstock_csv": true,
"resstock_buildstock_csv_path": "resources/residential-measures/test/base_results/baseline/annual/buildstock.csv"
},
"geometry": {
"type": "Polygon",
Expand Down
64 changes: 58 additions & 6 deletions example_project/mappers/Baseline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def initialize

# add any paths local to the project
@@osw[:measure_paths] << File.join(File.dirname(__FILE__), '../measures/')
@@osw[:measure_paths] << File.join(File.dirname(__FILE__), '../resources/hpxml-measures')
@@osw[:measure_paths] << File.join(File.dirname(__FILE__), '../resources/residential-measures/resources/hpxml-measures')
@@osw[:file_paths] << File.join(File.dirname(__FILE__), '../weather/')

# configures OSW with extension gem paths for measures and files, all extension gems must be
Expand Down Expand Up @@ -264,7 +264,7 @@ def commercial_building_types
def get_climate_zone_iecc(epw)
headers = CSV.open(epw, 'r', &:first)
wmo = headers[5]
zones_csv = Pathname(__FILE__).dirname.parent / 'resources' / 'hpxml-measures' / 'HPXMLtoOpenStudio' / 'resources' / 'data' / 'climate_zones.csv'
zones_csv = Pathname(__FILE__).dirname.parent / 'resources' / 'residential-measures' / 'resources' / 'hpxml-measures' / 'HPXMLtoOpenStudio' / 'resources' / 'data' / 'climate_zones.csv'

# Check if the CSV file is empty
if File.empty?(epw)
Expand Down Expand Up @@ -549,12 +549,13 @@ def create_osw(scenario, features, feature_names)
end

# Start general residential mapping
# mappers/residential/util.rb
args = {}
require File.join(File.dirname(__FILE__), 'residential/util')
residential(scenario, feature, args, building_type)

# Then onto optional "template" mapping
# mappers/residential/template
# mappers/residential/template/util.rb
template = nil
begin
template = feature.template
Expand All @@ -566,9 +567,60 @@ def create_osw(scenario, features, feature_names)
residential_template(args, template, climate_zone)
end

# Parse BuildResidentialModel measure xml so we can override defaults
# Then onto optional "samples" mapping
# mappers/residential/samples/util.rb
uo_resstock_connection = false
begin
uo_resstock_connection = feature.characterize_residential_buildings_from_buildstock_csv
rescue StandardError
end

# Run workflows if UO-ResStock connection is established
if uo_resstock_connection

buildstock_csv_path = nil
begin
csv_path = feature.resstock_buildstock_csv_path
buildstock_csv_path = File.absolute_path(File.join(File.dirname(__FILE__), '..', csv_path))
rescue StandardError
@@logger.error("\n resstock_buildstock_csv_path was not assigned by the user.")
end

uo_buildstock_mapping_csv_path = nil
begin
mapping_csv_path = feature.uo_buildstock_mapping_csv_path
uo_buildstock_mapping_csv_path = File.absolute_path(File.join(File.dirname(__FILE__), '..', mapping_csv_path))
rescue StandardError
@@logger.error("\n uo_buildstock_mapping_csv_path was not assigned by the user")
end

require File.join(File.dirname(__FILE__), 'residential/samples/util')
if !buildstock_csv_path.nil? # If resstock_buildstock_csv_path is provided
@@logger.info("Processing with BuildStock CSV path.")

start_time = Time.now # To document the time of finding the resstock building id
resstock_building_id = find_resstock_building_id(buildstock_csv_path, feature, building_type, @@logger)
puts "Processing time for finding a building match (resstock_building_id = #{resstock_building_id}) from the buildstock CSV: #{Time.now - start_time} seconds."

residential_samples(args, resstock_building_id, buildstock_csv_path)

elsif !uo_buildstock_mapping_csv_path.nil? # If uo_buildstock_mapping_csv_path is provided
@@logger.info("Processing with UO-BuildStock mapping CSV path.")

start_time = Time.now # To document the time of getting the resstock building id
resstock_building_id = find_building_for_uo_id(uo_buildstock_mapping_csv_path, feature.id)
puts "Processing time for finding the building match (resstock_building_id = #{resstock_building_id}) from the buildstock CSV: #{Time.now - start_time} seconds."

residential_samples(args, resstock_building_id, uo_buildstock_mapping_csv_path) # uo_buildstock_mapping_csv_path may contain a subset of all parameters

else
@@logger.error("The user did not specify either the uo_buildstock_mapping_csv_path or the resstock_buildstock_csv_path. At least one of these is required for UO - ResStock connection.")
end
end

# Parse BuildResidentialHPXML measure xml so we can fill "args" in with default values where keys aren't already assigned
default_args = {}
measures_dir = File.absolute_path(File.join(File.dirname(__FILE__), '../resources/hpxml-measures'))
measures_dir = File.absolute_path(File.join(File.dirname(__FILE__), '../resources/residential-measures/resources/hpxml-measures'))
measure_xml = File.read(File.join(measures_dir, 'BuildResidentialHPXML', 'measure.xml'))
measure = REXML::Document.new(measure_xml).root
measure.elements.each('arguments/argument') do |arg|
Expand All @@ -581,7 +633,7 @@ def create_osw(scenario, features, feature_names)
end
end

build_res_model_args = [:feature_id, :schedules_type, :schedules_random_seed, :schedules_variation, :geometry_num_floors_above_grade, :hpxml_dir, :output_dir]
build_res_model_args = [:urbanopt_feature_id, :resstock_buildstock_csv_path, :resstock_building_id, :schedules_type, :schedules_random_seed, :schedules_variation, :geometry_num_floors_above_grade, :hpxml_dir, :output_dir]
args.each_key do |arg_name|
unless default_args.key?(arg_name)
next if build_res_model_args.include?(arg_name)
Expand Down
Loading
Loading