Skip to content

Commit

Permalink
Os39 (#494)
Browse files Browse the repository at this point in the history
* use os3.9 rc3 image in CI, and minor CI cleanups

* bump to version 0.14.0

* use os39 branches for testing

* point example_files Gemfile to new branches

* cleanup dependencies

* copy files from example-project repo, and update gemfile

* point to extension-gem & core during testing

* update python dependency versions

* Revert "copy files from example-project repo, and update gemfile"

This reverts commit 1bef4b8.

* update example_files/Gemfile properly

* tell example_files/Gemfile to use Ruby 3.2.2

* second try copying from example-project repo

* add measures dir when creating every project dir now

* bump to version 1.0.0

* use real os39 image in CI

* add .coverage to gitignore

* clean up unused variables in spec file

* address a couple rubocop issues

* new test geojson with shortened begin/end dates

* update base workflow to default to whole year run period

* use geojson with shorter run period for tests

* new test geojson files with shorter run periods

* use new test geojson files in tests

* use released gems, woohoo!

* fix typos from changing run period during tests

* comment results validation test temporarily

* pick up newest version of ThermalNetwork

* pick up newest version of GMT

---------

Co-authored-by: kflemin <[email protected]>
  • Loading branch information
vtnate and kflemin authored Jan 29, 2025
1 parent 761206a commit d17059a
Show file tree
Hide file tree
Showing 874 changed files with 941,140 additions and 421,410 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/nightly_ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ name: CLI CI

on:
workflow_dispatch:
# Run on demand and weeknights
push:
# Run on demand and weeknights
schedule:
# # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# # 5:24 am UTC (11:24pm MDT the day before) every weekday night in MDT
- cron: '24 5 * * 2-6'
# # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# # 5:24 am UTC (11:24pm MDT the day before) every weekday night in MDT
- cron: "24 5 * * 2-6"

env:
# Favor_Local_Gems enforces develop branch of all Ruby dependencies
# This is our canary in the coal mine! If any simulation tests fail, comment this and retry.
# If CI is then successful, we have a breaking change in a dependency somewhere.
# FAVOR_LOCAL_GEMS: true
GEM_DEVELOPER_KEY: ${{ secrets.GEM_DEVELOPER_KEY }}
# RUBYLIB: /usr/local/openstudio-3.7.0/Ruby
UO_NUM_PARALLEL: 4
# GHA machines have 4 cores. Trying to run more concurrently will slow everything down.
# https://github.blog/2024-01-17-github-hosted-runners-double-the-power-for-open-source/
Expand All @@ -29,19 +28,19 @@ jobs:
simulation-type: [basic, GHE, GEB, residential, electric]
runs-on: ubuntu-latest
container:
image: docker://nrel/openstudio:3.7.0
image: docker://nrel/openstudio:3.9.0
steps:
- uses: actions/checkout@v4
- name: Change Owner of Container Working Directory
# working dir permissions workaround from https://github.com/actions/runner-images/issues/6775s#issuecomment-1377299658
# working dir permissions workaround from https://github.com/actions/runner-images/issues/6775s#issuecomment-1377299658
run: |
chown root:root .
- name: Install Ruby dependencies
run: |
which ruby
ruby --version
bundle install
bundle update
bundle exec certified-update
- name: Install python dependencies
if: ${{ matrix.simulation-type == 'electric' || matrix.simulation-type == 'GHE' }}
run: bundle exec rspec -e 'Install python dependencies'
Expand All @@ -56,7 +55,7 @@ jobs:
- name: Test simulations
run: bundle exec rspec -e 'Run and work with a small ${{ matrix.simulation-type }} simulation'
- name: Upload artifacts
# Save results for examination - useful for debugging
# Save results for examination - useful for debugging
uses: actions/upload-artifact@v3
# Using v4 would mean we have to change our path design, and/or the test dir names
# Only upload if a previous step fails
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.yardoc
/_yardoc/
/coverage/
.coverage
/doc/
/pkg/
/spec/reports/
Expand Down
68 changes: 33 additions & 35 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ gemspec
# checkout the latest version (develop) from github.
allow_local = ENV['FAVOR_LOCAL_GEMS']

# pin this dependency to avoid unicode_normalize error
gem 'addressable', '2.8.1'
# pin this dependency to avoid using racc dependency (which has native extensions)
gem 'parser', '3.2.2.2'

# Uncomment (and modify path/branch) if you need to test local development versions. Otherwise
# these are included in the gemspec file
#
Expand All @@ -24,33 +19,36 @@ gem 'parser', '3.2.2.2'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
# end

# 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: '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: '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: '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: '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: 'develop'
# end
# gem 'openstudio-extension', '0.8.3'

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

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: '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: '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: '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: '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: 'develop'
end
27 changes: 12 additions & 15 deletions example_files/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'http://rubygems.org'

ruby '~> 2.7.0'
ruby '3.2.2'

# Local gems are useful when developing and integrating the various dependencies.
# To favor the use of local gems, set the following environment variable:
Expand All @@ -17,73 +17,70 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/openstudio-extension-gem', branch: 'develop'
# else
# gem 'openstudio-extension', '~> 0.8.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: 'develop'
# gem 'urbanopt-core', github: 'URBANopt/urbanopt-core-gem', branch: 'master'
# end

# pin this dependency to avoid unicode_normalize error
gem 'addressable', '2.8.1'
# pin this dependency to avoid using racc dependency (which has native extensions)
gem 'parser', '3.2.2.2'

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: 'develop'
else
gem 'openstudio-common-measures', '~> 0.9.0'
gem 'openstudio-common-measures', '~> 0.11.1'
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: 'develop'
else
gem 'openstudio-model-articulation', '~> 0.9.0'
gem 'openstudio-model-articulation', '~> 0.11.1'
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: 'develop'
else
gem 'openstudio-load-flexibility-measures', '~> 0.8.0'
gem 'openstudio-load-flexibility-measures', '~> 0.10.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: 'develop'
else
gem 'openstudio-ee', '~> 0.9.0'
gem 'openstudio-ee', '~> 0.11.1'
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: 'develop'
else
gem 'openstudio-calibration', '~> 0.9.0'
gem 'openstudio-calibration', '~> 0.11.1'
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: 'master'
else
gem 'openstudio-geb', '~> 0.4.0'
gem 'openstudio-geb', '~> 0.6.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: 'develop'
else
gem 'urbanopt-geojson', '~> 0.11.2'
gem 'urbanopt-geojson', '~> 1.0.0'
end

# NEVER put SCENARIO-GEM in this file...it will make all simulations fail due to the sqlite dependency
Expand All @@ -94,5 +91,5 @@ if allow_local && File.exist?('../urbanopt-reporting-gem')
elsif allow_local
gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'develop'
else
gem 'urbanopt-reporting', '~> 0.10.1'
gem 'urbanopt-reporting', '~> 1.0.0'
end
14 changes: 7 additions & 7 deletions example_files/mappers/Baseline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,15 @@ 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' / 'residential-measures' / 'resources' / 'hpxml-measures' / 'HPXMLtoOpenStudio' / 'resources' / 'data' / 'climate_zones.csv'
zones_csv = Pathname(__FILE__).dirname.parent / 'resources' / 'residential-measures' / 'resources' / 'hpxml-measures' / 'HPXMLtoOpenStudio' / 'resources' / 'data' / 'zipcode_weather_stations.csv'

# Check if the CSV file is empty
if File.empty?(epw)
raise "Error: Your weather file #{epw} is empty."
end

CSV.foreach(zones_csv) do |row|
if row[0].to_s == wmo.to_s
if row[7].to_s == wmo.to_s
return row[6].to_s
end
end
Expand Down Expand Up @@ -343,7 +343,7 @@ def get_future_emissions_region(feature)
region = future_emissions_mapping_hash[state.to_sym]

@@logger.warn("emissions_future_subregion for #{state} is assigned to: #{region}. Note: Not all states have a 1 to 1 mapping with a subregion. Some states('ND','IN', 'MN', 'SD', 'IA', 'WV', 'OH', 'NE' ) include 2 subregions.
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifiying the emissions_future_subregion input in the FeatureFile.")
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifying the emissions_future_subregion input in the FeatureFile.")

return region
end
Expand Down Expand Up @@ -410,7 +410,7 @@ def get_hourly_historical_emissions_region(feature)
# find region input based on the state
region = hourly_historical_mapping_hash[state.to_sym]
@@logger.warn("emissions_hourly_historical_subregion for #{state} is assigned to: #{region}. Note: Not all states have a 1 to 1 mapping with a subregion. Some states('ND','IN', 'MN', 'SD', 'IA', 'WV', 'OH', 'NE' ) include 2 subregions.
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifiying the emissions_hourly_historical_subregion input in the FeatureFile.")
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifying the emissions_hourly_historical_subregion input in the FeatureFile.")

return region
end
Expand Down Expand Up @@ -471,11 +471,11 @@ def get_annual_historical_emissions_region(feature)
# get the state from weather file
state = feature.weather_filename.split('_', -1)[1]

# finf region input based on the state
# find region input based on the state
region = annual_historical_mapping_hash[state.to_sym]

@@logger.warn("electricity_emissions_annual_historical_subregion for #{state} is assigned to: #{region}. Note: Not all states have a 1 to 1 mapping with a subregion. Some states('ND','IN', 'MN', 'SD', 'IA', 'WV', 'OH', 'NE' ) include 2 subregions.
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifiying the electricity_emissions_annual_historical_subregion input in the FeatureFile.")
The default mapper maps to the subregion that includes the most zipcodes in the corresponding state. You can overwrite this assigned input by specifying the electricity_emissions_annual_historical_subregion input in the FeatureFile.")

return region
end
Expand Down Expand Up @@ -1008,7 +1008,7 @@ def time_mapping(time)

end

######## Emissions Adition from add_ems_emissions_reporting
######## Emissions Addition from add_ems_emissions_reporting
if feature_type == 'Building'

# emissions options
Expand Down
4 changes: 2 additions & 2 deletions example_files/mappers/PeakHoursMelsShedding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def create_osw(scenario, features, feature_names)
# Percentage Reduction of Electric Equipment Power (%). Enter a value between 0 and 100
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'epd_reduce_percent', 50.0)
# Starting Time for the Reduction in HH:MM:SS format
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'start_time', '17:00:00')
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'start_time1', '17:00:00')
# End Time for the Reduction in HH:MM:SS format
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'end_time', '21:00:00')
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'end_time1', '21:00:00')

# First Starting Date for the Reduction in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'reduce_epd_by_percentage_for_peak_hours', 'start_date1', '07-01')
Expand Down
20 changes: 10 additions & 10 deletions example_files/mappers/PeakHoursThermostatAdjust.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@ def create_osw(scenario, features, feature_names)
# Degrees Fahrenheit to Adjust Cooling Setpoint By
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_adjustment', 2.0)
# Daily Start Time for Cooling Adjustment. Use 24 hour format HH:MM:SS
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_daily_starttime', '16:01:00')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_start_time1', '16:01:00')
# Daily End Time for Cooling Adjustment. Use 24 hour format HH:MM:SS
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_daily_endtime', '20:00:00')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_end_time1', '20:00:00')
# Start Date for Cooling Adjustment in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_startdate', '06-01')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_start_date1', '06-01')
# End Date for Cooling Adjustment in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_enddate', '09-30')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'cooling_end_date1', '09-30')

# Degrees Fahrenheit to Adjust Heating Setpoint By
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_adjustment', -2.0)
# Daily Start Time for Heating Adjustment. Use 24 hour format HH:MM:SS
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_daily_starttime', '18:01:00')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_start_time1', '18:01:00')
# Daily End Time for Heating Adjustment. Use 24 hour format HH:MM:SS
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_daily_endtime', '22:00:00')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_end_time1', '22:00:00')
# Start Date for Heating Adjustment Period 1 in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_startdate_1', '01-01')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_start_date1', '01-01')
# End Date for Heating Adjustment Period 1 in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_enddate_1', '05-31')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_end_date1', '05-31')
# Start Date for Heating Adjustment Period 2 in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_startdate_2', '10-01')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_start_date2', '10-01')
# End Date for Heating Adjustment Period 2 in MM-DD format
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_enddate_2', '12-31')
OpenStudio::Extension.set_measure_argument(osw, 'AdjustThermostatSetpointsByDegreesForPeakHours', 'heating_end_date2', '12-31')

return osw
end
Expand Down
Loading

0 comments on commit d17059a

Please sign in to comment.