Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Version 1.1.0

* Update to OpenStudio 3.10 by @vtnate in <https://github.com/urbanopt/urbanopt-cli/pull/514>
* Update installer 1.0.2 by @tijcolem in <https://github.com/urbanopt/urbanopt-cli/pull/519>
* Update REopt assumptions files: `Storage` to `ElectricStorage` by @vtnate in <https://github.com/urbanopt/urbanopt-cli/pull/523>
* Use installer gems at runtime by @tijcolem in <https://github.com/urbanopt/urbanopt-cli/pull/525>

## Version 1.0.2

### Exciting New Features 🎉
Expand Down
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,38 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
# if allow_local && File.exist?('../OpenStudio-extension-gem')
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'faraday'
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
# end
# gem 'openstudio-extension', '0.9.3'

# gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'faraday'
# gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'

# if allow_local && File.exist?('../urbanopt-scenario-gem')
# gem 'urbanopt-scenario', path: '../urbanopt-scenario-gem'
# elsif allow_local
# gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'faraday'
# gem 'urbanopt-scenario', github: 'URBANopt/urbanopt-scenario-gem', branch: 'develop'
# 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: 'faraday'
# gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
# end

# if allow_local && File.exist?('../urbanopt-reopt-gem')
# gem 'urbanopt-reopt', path: '../urbanopt-reopt-gem'
# elsif allow_local
# gem 'urbanopt-reopt', github: 'URBANopt/urbanopt-reopt-gem', branch: 'faraday'
# gem 'urbanopt-reopt', github: 'URBANopt/urbanopt-reopt-gem', branch: 'develop'
# end

# if allow_local && File.exist?('../urbanopt-reporting-gem')
# gem 'urbanopt-reporting', path: '../urbanopt-reporting-gem'
# elsif allow_local
# gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'faraday'
# gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'develop'
# end

# if allow_local && File.exist?('../urbanopt-rnm-us-gem')
# gem 'urbanopt-rnm-us', path: '../urbanopt-rnm-us-gem'
# elsif allow_local
# gem 'urbanopt-rnm-us', github: 'URBANopt/urbanopt-rnm-us-gem', branch: 'faraday'
# gem 'urbanopt-rnm-us', github: 'URBANopt/urbanopt-rnm-us-gem', branch: 'develop'
# end
38 changes: 19 additions & 19 deletions example_files/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,71 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
# if allow_local && File.exist?('../OpenStudio-extension-gem')
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/openstudio-extension-gem', branch: 'faraday'
# gem 'openstudio-extension', github: 'NREL/openstudio-extension-gem', branch: 'develop'
# else
# gem 'openstudio-extension', '~> 0.9.3'
# gem 'openstudio-extension', '~> 0.9.3'
# end

# if allow_local && File.exist?('../urbanopt-core-gem')
# gem 'urbanopt-core', path: '../../urbanopt-core-gem'
# elsif allow_local
# gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'faraday'
# gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'develop'
# end

# if allow_local && File.exist?('../openstudio-common-measures-gem')
# gem 'openstudio-common-measures', path: '../../openstudio-common-measures-gem'
# elsif allow_local
# gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'faraday'
# gem 'openstudio-common-measures', github: 'NREL/openstudio-common-measures-gem', branch: 'develop'
# else
gem 'openstudio-common-measures', '~> 0.12.3'
gem 'openstudio-common-measures', '~> 0.12.3'
# end

# if allow_local && File.exist?('../openstudio-model-articulation-gem')
# gem 'openstudio-model-articulation', path: '../openstudio-model-articulation-gem'
# elsif allow_local
# gem 'openstudio-model-articulation', github: 'NREL/openstudio-model-articulation-gem', branch: 'faraday'
# gem 'openstudio-model-articulation', github: 'NREL/openstudio-model-articulation-gem', branch: 'develop'
# else
gem 'openstudio-model-articulation', '~> 0.12.2'
gem 'openstudio-model-articulation', '~> 0.12.2'
# end

# if allow_local && File.exist?('../openstudio-load-flexibility-measures-gem')
# gem 'openstudio-load-flexibility-measures', path: '../openstudio-load-flexibility-measures-gem'
# elsif allow_local
# gem 'openstudio-load-flexibility-measures', github: 'NREL/openstudio-load-flexibility-measures-gem', branch: 'faraday'
# gem 'openstudio-load-flexibility-measures', github: 'NREL/openstudio-load-flexibility-measures-gem', branch: 'develop'
# else
gem 'openstudio-load-flexibility-measures', '~> 0.11.1'
gem 'openstudio-load-flexibility-measures', '~> 0.11.1'
# end

# if allow_local && File.exist?('../openstudio-ee-gem')
# gem 'openstudio-ee', path: '../openstudio-ee-gem'
# elsif allow_local
# gem 'openstudio-ee', github: 'NREL/openstudio-ee-gem', branch: 'faraday'
# gem 'openstudio-ee', github: 'NREL/openstudio-ee-gem', branch: 'develop'
# else
gem 'openstudio-ee', '~> 0.12.5'
gem 'openstudio-ee', '~> 0.12.5'
# end

# if allow_local && File.exist?('../openstudio-calibration-gem')
# gem 'openstudio-calibration', path: '../openstudio-calibration-gem'
# elsif allow_local
# gem 'openstudio-calibration', github: 'NREL/openstudio-calibration-gem', branch: 'faraday'
# gem 'openstudio-calibration', github: 'NREL/openstudio-calibration-gem', branch: 'develop'
# else
gem 'openstudio-calibration', '~> 0.12.2'
gem 'openstudio-calibration', '~> 0.12.2'
# end

# if allow_local && File.exist?('../../openstudio-geb')
# gem 'openstudio-geb', path: '../../../openstudio-geb-gem'
# elsif allow_local
# gem 'openstudio-geb', github: 'LBNL-ETA/openstudio-geb-gem', branch: 'faraday'
# gem 'openstudio-geb', github: 'LBNL-ETA/openstudio-geb-gem', branch: 'develop'
# else
gem 'openstudio-geb', '~> 0.7.0'
gem 'openstudio-geb', '~> 0.7.0'
# 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: 'faraday'
# gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
# else
gem 'urbanopt-geojson', '~> 1.1.0'
gem 'urbanopt-geojson', '~> 1.1.0'
# end

# NEVER put SCENARIO-GEM in this file...it will make all simulations fail due to the sqlite dependency
Expand All @@ -90,7 +90,7 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
# if allow_local && File.exist?('../urbanopt-reporting-gem')
# gem 'urbanopt-reporting', path: '../../urbanopt-reporting-gem'
# elsif allow_local
# gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'faraday'
# gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'develop'
# else
gem 'urbanopt-reporting', '~> 1.1.0'
gem 'urbanopt-reporting', '~> 1.1.0'
# end
6 changes: 3 additions & 3 deletions example_files/mappers/Baseline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def create_osw(scenario, features, feature_names)

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.")
@@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)
Expand All @@ -605,7 +605,7 @@ def create_osw(scenario, features, feature_names)
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.")
@@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)
Expand All @@ -614,7 +614,7 @@ def create_osw(scenario, features, feature_names)
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.")
@@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

Expand Down
25 changes: 11 additions & 14 deletions example_files/mappers/residential/samples/util.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# *********************************************************************************
# URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC.
# See also https://github.com/urbanopt/urbanopt-example-geojson-project/blob/develop/LICENSE.md
# See also https://github.com/urbanopt/urbanopt-cli/blob/develop/LICENSE.md
# *********************************************************************************

require 'csv'
Expand Down Expand Up @@ -47,9 +47,9 @@ def find_resstock_building_id(buildstock_csv_path, feature, building_type, logge

# year_built
begin
mapped_properties['Vintage ACS'] = map_to_resstock_vintage(feature.year_built)
mapped_properties['Vintage ACS'] = map_to_resstock_vintage(feature.year_built)
rescue StandardError
logger.info("\nFeature #{feature.id}: year_built was not used to filter buildstock csv since it does not exist for this feature")
logger.info("\nFeature #{feature.id}: year_built was not used to filter buildstock csv since it does not exist for this feature")
end

# system_type
Expand Down Expand Up @@ -82,17 +82,15 @@ def find_resstock_building_id(buildstock_csv_path, feature, building_type, logge
return selected_id
end

def get_selected_id(mapped_properties, buildstock_csv_path, feature_id)
def get_selected_id(mapped_properties, buildstock_csv_path, feature_id)
# Find building matches
matches = []
infos = []

# read buildstock csv file
CSV.foreach(buildstock_csv_path, headers: true) do |row|

# find if it's a match using reduce
is_match = mapped_properties.reduce(true) do |acc, (key, values)|

current_match = values.map { |v| v.to_s.strip.downcase }.include?(row[key].to_s.strip.downcase)
acc && current_match
end
Expand All @@ -117,7 +115,7 @@ def get_selected_id(mapped_properties, buildstock_csv_path, feature_id)
infos << "\nFeature #{feature_id}: Multiple matches found. Selected one buildstock building ID randomly: #{selected_id} from #{matches.size} matching buildings: #{matches}. #{mapped_properties}"
end

### Log matching results to csv
### Log matching results to csv
# Path to your log CSV file
log_csv_path = File.join(File.dirname(__FILE__), '../../../run/resstock_buildstock_csv_match_log.csv')

Expand Down Expand Up @@ -163,22 +161,22 @@ def find_building_for_uo_id(uo_buildstock_mapping_csv_path, feature_id)

def map_to_resstock_building_type(res_type, number_of_residential_units)
'''Define function to map building type to categories.'''

if res_type == 'Multifamily'
if number_of_residential_units >= 5
return ['Multi-Family with 5+ Units']
elsif number_of_residential_units.between?(2, 4)
return ['Multi-Family with 2 - 4 Units']
else
return []
end
end
elsif res_type == 'Single-Family Attached'
return ['Single-Family Attached']
elsif res_type == 'Single-Family Detached'
return ['Single-Family Detached']
elsif res_type == 'Mobile Home'
return ['Mobile Home']
else
else
return ['Other Category']
end
end
Expand Down Expand Up @@ -261,10 +259,10 @@ def map_to_resstock_vintage(year_built)
vintage_mapping = {
'2000-09' => (2000..2009),
'1940-59' => (1940..1959),
'2010s' => (2010..2019),
'2010s' => (2010..2019),
'1980-99' => (1980..1999),
'1960-79' => (1960..1979),
'<1940' => (..1939)
'<1940' => (..1939)
}

resstock_vintage_ACS_category = nil
Expand Down Expand Up @@ -341,7 +339,7 @@ def map_to_resstock_heating_fuel(heating_system_fuel_type)
elsif heating_system_fuel_type == 'propane'
return ['Propane']
elsif heating_system_fuel_type == 'wood'
return ['Other Fuel']
return ['Other Fuel']
end
end

Expand All @@ -353,4 +351,3 @@ def map_to_resstock_num_occupants(number_of_occupants, number_of_residential_uni
return [number_of_occupants.to_s]
end
end

3 changes: 1 addition & 2 deletions example_files/mappers/residential/template/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ def residential_template(args, template, climate_zone)

# HVAC

{ args[:heating_system_type] => 'iecc/heating_system.tsv',
{ args[:heating_system_type] => 'iecc/heating_system.tsv',
args[:cooling_system_type] => 'iecc/cooling_system.tsv',
args[:heat_pump_type] => 'iecc/heat_pump.tsv' }.each do |type, path|

if type != 'none'
filepath = File.join(File.dirname(__FILE__), path)
lookup_tsv = get_lookup_tsv(args, filepath)
Expand Down
3 changes: 1 addition & 2 deletions example_files/measures/BuildResidentialModel/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def run(model, runner, user_arguments)

standards_number_of_living_units = units.size
else # get pre-made units
xml_building_folder = "xml_building"
xml_building_folder = 'xml_building'
hpxml_dir = File.join(File.dirname(__FILE__), "../../#{xml_building_folder}/#{args[:hpxml_dir]}")

if !File.exist?(hpxml_dir)
Expand Down Expand Up @@ -283,7 +283,6 @@ def run(model, runner, user_arguments)

hpxml_path = File.expand_path(args[:hpxml_path])
units.each_with_index do |unit, unit_num|

measures = {}
if !unit.key?('hpxml_path') # create a single new HPXML file describing all dwelling units of the feature

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def self.biquadratic(x, y, c)
-------
x float independent variable 1
y float independent variable 2
c tuple list of 6 coeffients [floats]
c tuple list of 6 coefficients [floats]
Outputs:
--------
z float result of biquadratic polynomial
Expand All @@ -138,7 +138,7 @@ def self.quadratic(x, c)
Inputs:
-------
x float independent variable
c tuple list of 6 coeffients [floats]
c tuple list of 6 coefficients [floats]

Outputs:
--------
Expand Down Expand Up @@ -166,7 +166,7 @@ def self.bicubic(x, y, c)
-------
x float independent variable 1
y float independent variable 2
c tuple list of 10 coeffients [floats]
c tuple list of 10 coefficients [floats]

Outputs:
--------
Expand Down
Loading