Skip to content

Commit

Permalink
Version 1.0.0 (#158)
Browse files Browse the repository at this point in the history
* Use Reopt v3, bump to v0.12.0 (#149)

* bump to call reopt v3 in URI

* update one tests dummy_data to conform to v3 specification

* bump to version 0.12.0 for using reopt-api v3

* WIP: flatten assumptions file and change us_dollars items for v3

* specify reopt version in assumptions file name

* upgrade LoadProfile to ElectricLoad for v3

* updates to basic assumptions to conform to v3 specifications

* rename 4tsperhour to 4tsperhour_v3

* update 4tsperhour to v3 specs

* update another dummy_data for v3 specs

* point to version-specified assumptions file

* WIP: flatten schema, update some keys, start changing types, move min/max

* WIP: more test assumptions file updates

* WIP: update docs with some of the v3 changes. More still needed

* WIP: a few initial changes to output schema. much still to do

* WIP: update adapter code for v3 keys

* create Meta top-level object in schema

* clean up min/max, specify fraction in description, etc

* add new optimality_tolerance key to schema

* bump outdated versions in index.md

* WIP: remove _us_dollars from lcc key in output

* flatten schema to conform to reopt-api v3

* use standard schema types

* remove `us_dollars` from outputs and update Profile & LoadProfile

* remove `us_dollars` from keys for v3

* change `Storage` to `ElectricStorage`

* WIP: schema and code changes for `year_one` for v3

* update `net_` prefix in schema

* maybe last schema changes?

* move roof_squarefeet into Site in test file

* a few more schema fixes

* update adapters to read the flatter in/output from reopt

* reopt-lite-api code to read/write the flatter files

* post-processor to read flatter outputs

* docs to show flatter input example

* different json path to description in reopt input

* move a couple schema items from ElectricTariff to ElectricUtility

* read flatter json output in test

* remove coincident_peak_load_charge from assumptions files

* rename meta block of input schema properly

* fix typo and clean up base reopt post

* no longer need to declare wind==0Kw to deactivate it in v3

* no longer need wind = 0kW to deactivate it

* wip fixing REopt optimization calls

* default run_resilience to `false`

* attempt to send utility & rate to reopt

* this reopt input file works

* wait longer in reopt_api call

* update 4tsperhour reopt input file

* update assumptions file paths

* feature_report_adapter a bit more like scenario_report_adapter

* clarify test phrasing

* clarify default reopt assumptions in adapters

* standardize and universalize more paths in spec file

* remove unused commented code from spec file

* more path improvement in spec file

* update one more path

* use urdb label for rate source

* add resilience run & assertion to `process scenario report` test

* increase sleep time and gather reopt output a little better

* restore log to debug level after confirming correct output

* comment resilience run & assertion temporarily

* add section headers to tests

* start of updating reopt output keys

* point to modified scenario-gem which has updated reporting-gem content

* update more keys for reopt-v3

* more key and existence changes to scenario adapter

* point to dependent branches in scenario and reporting gems

* update feature adapter with v3 keys

* update input/output keys

* clean up Nates outdated code

* similar fixes to handling reopt outputs as feature-adapter

* change puts to logging, and clarify statements

* copy default/blank assumptions to scenario-adapter

* remove temporary file production used for debugging/testing

* remove unnecessary puts statement

* more keys updated for reopt v3

* organize assumptions file sections a bit

* more if-statements for handling lack of PV

* update docs for required reopt inputs

* new assumptions file that includes wind

* add option to choose assumptions file with wind when running a test

* add another `if` for storage

* add wind to test assumptions files

* change lat/long in test feature reports

* make monthly energy rates in test file a little more expensive

* point to assumptions file with wind for tests

* remove outdated assumptions file

* point to released scenario-gem v0.12.0

* enable manually running CI (once merged to develop)

* update changelog for v0.12.0

---------

Co-authored-by: kflemin <[email protected]>

* update reopt ghp lcca outputs in schema

* bump to v0.13.0

* clarify ruby version, remove duplicate dependencies

* use branches of UO gems

* use OS3.8 in CI

* use extension-gem branch temporarily

* ensure we install bundle according to gemspec & gemfile in CI

* non-substantive typos

* remove requirement for certified because of Ruby 3

* remove references to certified, and make error messages visible

* remove test file that doesn't do anything and isn't used

* add input processing

* use newly released patch version 0.8.1 of extension-gem

* add reopt api call and tests

* update test files and code

* make folder  reopt input only when not exist, add heat pump size

* update electrical power value

* update reopt api polling

* add test

* update tests

* uodate tests

* remove puts statement

* update input reopt file

* update reopt assumption file

* update whitespace

* update modelica result

* update inputs

* expose error messages for certificate verify failed (#151)

* expose error messages for certificate verify failed

* fix comment typos

* remove duplicate error message

* run CI on push instead of on review_requested

---------

Co-authored-by: Nathan Moore <[email protected]>

* uncomment test

* add feature reports

* update test

* update schema

* update gitignore

* expose error messages for certificate verify failed (#151)

* expose error messages for certificate verify failed

* fix comment typos

* remove duplicate error message

* run CI on push instead of on review_requested

---------

Co-authored-by: Nathan Moore <[email protected]>

* fix typos and linting

* clean up a few more paths

* use run_dir from class instatiation instead of manually

* more path cleanup

* remove reopt_ghp transient test dir from git

* remove extra trailing newline from gitignore

* fix path to test dir in gitignore

* delete one more test outuput file during the test

* fix path to reopt_ghp during test prep

* WIP: fix a few magic numbers

* probably last path cleanup in spec file

* fix path for test file deletion

* update ghp adapter, add hour variable, update tests

* add formatting correction.

* update reopt ghp lcca outputs in schema

* add input processing

* add reopt api call and tests

* update test files and code

* make folder  reopt input only when not exist, add heat pump size

* update electrical power value

* update reopt api polling

* add test

* update tests

* uodate tests

* remove puts statement

* update input reopt file

* update reopt assumption file

* update whitespace

* update modelica result

* update inputs

* uncomment test

* add feature reports

* update test

* update schema

* update gitignore

* expose error messages for certificate verify failed (#151)

* expose error messages for certificate verify failed

* fix comment typos

* remove duplicate error message

* run CI on push instead of on review_requested

---------

Co-authored-by: Nathan Moore <[email protected]>

* fix typos and linting

* clean up a few more paths

* use run_dir from class instatiation instead of manually

* more path cleanup

* remove reopt_ghp transient test dir from git

* remove extra trailing newline from gitignore

* fix path to test dir in gitignore

* delete one more test outuput file during the test

* fix path to reopt_ghp during test prep

* WIP: fix a few magic numbers

* probably last path cleanup in spec file

* fix path for test file deletion

* update ghp adapter, add hour variable, update tests

* add formatting correction.

* use os39 branches for testing

* use os39 rc3 image in CI

* remove certified requirement, not necessary in Ruby 3

* don't track test output files in git

* use correct syntax for reopt_ghp in gitignore

* use real OS3.9 in CI

* use extension-gem branch

* update dependencies

* Updates to handle breaking changes from REopt v3.11 (#157)

* use released versions of gems

* bump to v1.0.0

* add year to district input for ElectricLoad

* add year to ElectricLoad for GHP assumptions

* add year to ElectricLoad test assumption files

* use `v3` in ghp test api url instead of `stable`

* rubocop formatting

* remove unused variable

* less action & more assertion in 15-minute-interval test

* update changelog

* update copyright

---------

Co-authored-by: Nathan Moore <[email protected]>
Co-authored-by: Tanushree <[email protected]>
  • Loading branch information
3 people authored Jan 27, 2025
1 parent 47cb19f commit 2e29bee
Show file tree
Hide file tree
Showing 38 changed files with 38,297 additions and 85 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/nightly_ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: REopt-gem CI

on:
workflow_dispatch:
# push:
push:
schedule:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
# 5:23 am UTC (11:23pm MDT the day before) every weekday night in MDT
- cron: '23 5 * * 2-6'
pull_request:
types: [review_requested]

env:
# This env var should enforce develop branch of all dependencies
Expand All @@ -21,17 +19,16 @@ jobs:
# https://github.com/rbenv/ruby-build/discussions/1940
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: set git config options
shell: bash
run: |
git config --global --add safe.directory '*'
run: git config --global --add safe.directory '*'
- name: Update gems
run: |
bundle install
bundle update
bundle exec certified-update
- name: Run Rspec
run: bundle exec rspec
- name: Coveralls
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/lib/measures/test_results
/lib/measures/.rubocop*
# test files
spec/run/
spec/files/run/baseline_scenario_ghe/reopt_ghp/

developer_nrel_key.rb
# rspec failure tracking
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@
# URBANopt REopt Gem

## Version 1.0.0

## What's Changed

* Upgrade to OpenStudio 3.9 and Ruby 3.2.2 by @vtnate in https://github.com/urbanopt/urbanopt-reopt-gem/pull/155
* Updates for REopt v3.11 by @vtnate in https://github.com/urbanopt/urbanopt-reopt-gem/pull/157

### Other Changes

* expose error messages for certificate verify failed by @kflemin in https://github.com/urbanopt/urbanopt-reopt-gem/pull/151
* REopt GHP LCCA Analysis by @tanushree04 in https://github.com/urbanopt/urbanopt-reopt-gem/pull/153

**Full Changelog**: https://github.com/urbanopt/urbanopt-reopt-gem/compare/v0.12.0...v1.0.0

## Version 0.12.0

Date Range: 01/11/24 - 05/06/24

* Use Reopt v3 by @vtnate in https://github.com/urbanopt/urbanopt-reopt-gem/pull/149

**Full Changelog**: https://github.com/urbanopt/urbanopt-reopt-gem/compare/v0.11.0...v0.12.0

## Version 0.11.0

Date Range: 07/06/23 - 01/11/24

* Use different error messages in different places by @vtnate in https://github.com/urbanopt/urbanopt-reopt-gem/pull/145
Expand All @@ -17,6 +34,7 @@ Date Range: 07/06/23 - 01/11/24
**Full Changelog**: https://github.com/urbanopt/urbanopt-reopt-gem/compare/v0.10.0...v0.11.0

## Version 0.10.0

Date Range: 12/13/22 - 7/6/23

- Update dependencies for OpenStudio 3.6.1
Expand Down
27 changes: 16 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ 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: 'develop'
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
# else
# gem 'openstudio-extension', '~> 0.8.1'
# end
#
# if allow_local && File.exist?('../openstudio-common-measures-gem')
Expand All @@ -41,14 +43,17 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
# gem 'openstudio-model-articulation', '0.1.0'
# 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: 'reopt-v3'
# 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.exists?('../urbanopt-geojson-gem')
# gem 'urbanopt-geojson', path: '../urbanopt-geojson-gem'
# elsif allow_local
# gem 'urbanopt-geojson', github: 'URBANopt/urbanopt-geojson-gem', branch: 'develop'
# end
# Temporary! Remove this once reporting-gem is merged/released
# gem 'urbanopt-reporting', github: 'URBANopt/urbanopt-reporting-gem', branch: 'develop'

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
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
2 changes: 1 addition & 1 deletion doc_templates/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
2 changes: 1 addition & 1 deletion doc_templates/copyright_erb.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%
# *********************************************************************************
# URBANopt (tm), Copyright (c) 2019-2024, Alliance for Sustainable Energy, LLC, and other
# URBANopt (tm), Copyright (c) 2019-2025, Alliance for Sustainable Energy, LLC, and other
# contributors. All rights reserved.

# Redistribution and use in source and binary forms, with or without modification,
Expand Down
2 changes: 1 addition & 1 deletion docs/schemas/reopt-output-schema.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REopt Lite Outputs Schema

When the gem calls the REopt Lite APUI it recieves the following complete set of results described in the data dictionary below. Only those needed to update a Feature or Scenario Report's distributed_generation attibute set and timeseries CSV are pulled from the reponse and transferred to the Feature or Scenario Report. You may choose to modify the code to include more or less of the full REopt Lite response.
When the gem calls the REopt Lite APUI it receives the following complete set of results described in the data dictionary below. Only those needed to update a Feature or Scenario Report's distributed_generation attribute set and timeseries CSV are pulled from the response and transferred to the Feature or Scenario Report. You may choose to modify the code to include more or less of the full REopt Lite response.

## Data Dictionary
<ReoptOutputSchema />
Expand Down
3 changes: 3 additions & 0 deletions lib/urbanopt/reopt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
require 'urbanopt/reopt/scenario_report_adapter'
require 'urbanopt/reopt/reopt_post_processor'
require 'urbanopt/reopt/version'
require 'urbanopt/reopt/reopt_ghp_post_processor'
require 'urbanopt/reopt/reopt_ghp_adapter'
require 'urbanopt/reopt/reopt_ghp_api'
13 changes: 6 additions & 7 deletions lib/urbanopt/reopt/feature_report_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def reopt_json_from_feature_report(feature_report, reopt_assumptions_hash = nil,
else
@@logger.info('Using default REopt assumptions')
reopt_inputs = {
Settings:{},
Settings: {},
Site: {},
Financial:{},
Financial: {},
ElectricTariff: {
monthly_demand_rates: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
monthly_energy_rates: [0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
Expand Down Expand Up @@ -151,14 +151,13 @@ def reopt_json_from_feature_report(feature_report, reopt_assumptions_hash = nil,
#
# [*parameters:*]
#
# * +feature_report+ - _URBANopt::Reporting::DefaultReports::FeatureReport_ - FeatureReport to update from a \REopt reponse hash.
# * +reopt_output+ - _Hash_ - A reponse hash from the \REopt API to use in overwriting FeatureReport technology sizes, costs and dispatch strategies.
# * +feature_report+ - _URBANopt::Reporting::DefaultReports::FeatureReport_ - FeatureReport to update from a \REopt response hash.
# * +reopt_output+ - _Hash_ - A response hash from the \REopt API to use in overwriting FeatureReport technology sizes, costs and dispatch strategies.
# * +timeseries_csv_path+ - _String_ - Optional. The path to a file at which a new timeseries CSV will be written. If not provided a file is created based on the run_uuid of the \REopt optimization task.
#
# [*return:*] _URBANopt::Reporting::DefaultReports::FeatureReport_ - Returns an updated FeatureReport.
##
def update_feature_report(feature_report, reopt_output, timeseries_csv_path = nil, resilience_stats = nil)

# Check if the \REopt response is valid
if reopt_output['status'] != 'optimal'
@@logger.error("ERROR cannot update Feature Report #{feature_report.name} #{feature_report.id} - REopt optimization was non-optimal")
Expand Down Expand Up @@ -439,15 +438,15 @@ def modrow(x, i) # :nodoc:
x[$storage_to_grid_col] = $storage_to_grid[i] || 0 if defined?(storage)
x[$storage_soc_col] = $storage_soc[i] || 0 if defined?(storage)
x[$generator_total_col] = $generator_total[i] || 0 if defined?(generator)
x[$generator_to_battery_col] = $generator_to_battery[i] || 0 if (defined?(generator) && defined?(storage))
x[$generator_to_battery_col] = $generator_to_battery[i] || 0 if defined?(generator) && defined?(storage)
x[$generator_to_load_col] = $generator_to_load[i] || 0 if defined?(generator)
x[$generator_to_grid_col] = $generator_to_grid[i] || 0 if defined?(generator)
x[$pv_total_col] = $pv_total[i] || 0
x[$pv_to_battery_col] = $pv_to_battery[i] || 0 if defined?(storage)
x[$pv_to_load_col] = $pv_to_load[i] || 0
x[$pv_to_grid_col] = $pv_to_grid[i] || 0
x[$wind_total_col] = $wind_total[i] || 0 if defined?(wind)
x[$wind_to_battery_col] = $wind_to_battery[i] || 0 if (defined?(wind) && defined?(storage))
x[$wind_to_battery_col] = $wind_to_battery[i] || 0 if defined?(wind) && defined?(storage)
x[$wind_to_load_col] = $wind_to_load[i] || 0 if defined?(wind)
x[$wind_to_grid_col] = $wind_to_grid[i] || 0 if defined?(wind)
return x
Expand Down
Loading

0 comments on commit 2e29bee

Please sign in to comment.