From 9ca680ae383d0a6426c8371d0e55957779058d68 Mon Sep 17 00:00:00 2001 From: tijcolem Date: Fri, 2 Feb 2024 15:40:15 -0700 Subject: [PATCH 1/5] updates for OpenStudio 3.7.0 and uo 0.11 --- CMakeLists.txt | 14 +++++++------- FindOpenStudioSDK.cmake | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a2e3e68..bb3af474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10.2) cmake_policy(SET CMP0048 NEW) -project(URBANoptCLI VERSION 0.10.0) +project(URBANoptCLI VERSION 0.11.0) include(FindOpenStudioSDK.cmake) @@ -89,16 +89,16 @@ option(BUILD_PACKAGE "Build package" OFF) # need to update the MD5sum for each platform and url below if(UNIX) if(APPLE) - set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20230731-darwin.tar.gz") - set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "6dcaeb17c6567d5e5242c470b0ff2eb0") + set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20240202-darwin.tar.gz") + set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "27dad609451f5b0e7835efbcb8e362b7") else() - set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20230731-linux.tar.gz") - set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "ff67d59a162288cb7e5d4632e970e53d") + set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20240202-linux.tar.gz") + set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "2182c1ca7bcd85505db4700f4937d181") endif() elseif(WIN32) if(CMAKE_CL_64) - set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20230801-windows.tar.gz") - set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "2293f9f07643d110a84afaa0c1049c03") + set(URBANOPT_CLI_GEMS_ZIP_FILENAME "urbanopt-cli-gems-20240202-windows.tar.gz") + set(URBANOPT_CLI_GEMS_ZIP_EXPECTED_MD5 "7a7cc4f928646363bd57b41e10caebca") endif() endif() diff --git a/FindOpenStudioSDK.cmake b/FindOpenStudioSDK.cmake index 6a82a4ef..93fe304c 100644 --- a/FindOpenStudioSDK.cmake +++ b/FindOpenStudioSDK.cmake @@ -1,6 +1,6 @@ set(OPENSTUDIO_VERSION_MAJOR 3) -set(OPENSTUDIO_VERSION_MINOR 6) -set(OPENSTUDIO_VERSION_PATCH 1) +set(OPENSTUDIO_VERSION_MINOR 7) +set(OPENSTUDIO_VERSION_PATCH 0) set(OPENSTUDIO_VERSION "${OPENSTUDIO_VERSION_MAJOR}.${OPENSTUDIO_VERSION_MINOR}.${OPENSTUDIO_VERSION_PATCH}") find_package(openstudio "${OPENSTUDIO_VERSION}" CONFIG) @@ -16,23 +16,23 @@ else() set(OPENSTUDIO_BASELINK "https://openstudio-builds.s3.amazonaws.com/${OPENSTUDIO_VERSION}" CACHE STRING "Base link to where the openstudio archives are hosted" FORCE) - set(OPENSTUDIO_VERSION_SHA "+bb9481519e") + set(OPENSTUDIO_VERSION_SHA "+d5269793f1") if(APPLE) - set(OPENSTUDIO_EXPECTED_HASH ba881908f683ec695c209399f261b299) + set(OPENSTUDIO_EXPECTED_HASH a4585ef0a3523168f8975ecd1cff1d12) set(OPENSTUDIO_PLATFORM "Darwin-x86_64") set(OPENSTUDIO_EXT "tar.gz") elseif(UNIX) if(LSB_RELEASE_VERSION_SHORT MATCHES "20.04") - set(OPENSTUDIO_EXPECTED_HASH 5e67958249d99f96149b4d5576c3d0ef) + set(OPENSTUDIO_EXPECTED_HASH 5c006e5e66e5e859206a63626ea2966f) set(OPENSTUDIO_PLATFORM "Ubuntu-20.04-x86_64") else() # Assumes 20.04 - set(OPENSTUDIO_EXPECTED_HASH 5e67958249d99f96149b4d5576c3d0ef) + set(OPENSTUDIO_EXPECTED_HASH 5c006e5e66e5e859206a63626ea2966f) set(OPENSTUDIO_PLATFORM "Ubuntu-20.04-x86_64") endif() set(OPENSTUDIO_EXT "tar.gz") elseif(WIN32) - set(OPENSTUDIO_EXPECTED_HASH 802f8cffeac24f011e636baf1e6ffd40) + set(OPENSTUDIO_EXPECTED_HASH f192860357fdbffb5705942a991b072b) set(OPENSTUDIO_PLATFORM "Windows") set(OPENSTUDIO_EXT "tar.gz") endif() From 22037932dbd9d3c975c744babd9fd77fb4d31c9d Mon Sep 17 00:00:00 2001 From: tijcolem Date: Fri, 2 Feb 2024 15:54:00 -0700 Subject: [PATCH 2/5] update cmake base link for openstudio --- FindOpenStudioSDK.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FindOpenStudioSDK.cmake b/FindOpenStudioSDK.cmake index 93fe304c..537e845f 100644 --- a/FindOpenStudioSDK.cmake +++ b/FindOpenStudioSDK.cmake @@ -13,7 +13,7 @@ else() # find_package(openstudio "${OPENSTUDIO_VERSION}" CONFIG REQUIRED) - set(OPENSTUDIO_BASELINK "https://openstudio-builds.s3.amazonaws.com/${OPENSTUDIO_VERSION}" + set(OPENSTUDIO_BASELINK "https://github.com/NREL/OpenStudio/releases/download/v${OPENSTUDIO_VERSION}" CACHE STRING "Base link to where the openstudio archives are hosted" FORCE) set(OPENSTUDIO_VERSION_SHA "+d5269793f1") From a61f928b246633df4922a5cc3985f734f98b6f8f Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 8 Feb 2024 09:50:18 -0700 Subject: [PATCH 3/5] Call GMT-cli correctly (#449) * remove falsely-required model_type & add overwrite flags * test calling gmt-cli, including running modelica simulations! * include `ghe` category of tests in CI * skip test that runs modelica simulation if docker not installed * only test sys-param in basic if Python is available --- .github/workflows/nightly_ci_build.yml | 14 ++-- lib/uo_cli.rb | 19 ++++-- spec/uo_cli_spec.rb | 89 +++++++++++++++++--------- 3 files changed, 76 insertions(+), 46 deletions(-) diff --git a/.github/workflows/nightly_ci_build.yml b/.github/workflows/nightly_ci_build.yml index e16a89f0..f7b06461 100644 --- a/.github/workflows/nightly_ci_build.yml +++ b/.github/workflows/nightly_ci_build.yml @@ -24,8 +24,8 @@ jobs: strategy: matrix: # os: container operations in GHA only work on Ubuntu - simulation-type: [basic, GEB, residential, electric] - # python-version: No need to test more than 1 python-version + # https://docs.github.com/en/actions/using-containerized-services/about-service-containers + simulation-type: [basic, GHE, GEB, residential, electric] runs-on: ubuntu-latest container: image: docker://nrel/openstudio:3.7.0 @@ -34,19 +34,13 @@ jobs: - name: Change Owner of Container Working Directory # working dir permissions workaround from https://github.com/actions/runner-images/issues/6775#issuecomment-1377299658 run: chown root:root . - - name: Set up Python - if: ${{ matrix.simulation-type == 'electric' }} - uses: actions/setup-python@v5 - with: - # Disco needs python ~=3.10 - python-version: '3.10' - name: Install Ruby dependencies run: | ruby --version bundle update bundle exec certified-update - name: Install python dependencies - if: ${{ matrix.simulation-type == 'electric' || matrix.simulation-type == 'basic' }} + if: ${{ matrix.simulation-type == 'electric' || matrix.simulation-type == 'GHE' }} run: bundle exec rspec -e 'Install python dependencies' - name: Test project setup # We only need to run these tests once, not every matrix iteration. @@ -68,4 +62,4 @@ jobs: name: rspec_results path: | spec/test_directory**/ - retention-days: 7 # save for 1 week before deleting + retention-days: 7 # save for 1 week then delete diff --git a/lib/uo_cli.rb b/lib/uo_cli.rb index 7c997391..54ef24b6 100755 --- a/lib/uo_cli.rb +++ b/lib/uo_cli.rb @@ -376,6 +376,9 @@ def opt_des_params "Valid choices: 'time_series'", type: String, default: 'time_series' opt :ghe, "\nUse this argument to add Ground Heat Exchanger properties to the System Parameter File.\n", short: :g + + opt :overwrite, "\n Delete and rebuild existing sys-param file\n", short: :o + 'Example: uo des_params --sys-param-file path/to/sys_params.json --feature path/to/example_project.json --overwrite' end end @@ -390,11 +393,10 @@ def opt_des_create 'Example: uo des_create --feature path/to/example_project.json', type: String, required: true, short: :f opt :des_name, "\nPath to Modelica project dir to be created\n" \ - 'Example: uo des_create --des-name path/to/example_modelica_project', type: String, required: true - - opt :model_type, "\nSelection for which kind of DES simulation to perform\n" \ - "Valid choices: 'time_series'", type: String, default: 'time_series' + 'Example: uo des_create --des-name path/to/example_modelica_project', type: String, required: true, short: :n + opt :overwrite, "\nDelete and rebuild existing model directory\n", short: :o + 'Example: uo des_create --des-name path/to/example_modelica_project --overwrite' end end @@ -1758,6 +1760,10 @@ def self.install_python_dependencies end des_cli_addition += " --ghe" end + if @opthash.subopts[:overwrite] + puts "\nDeleting and rebuilding existing sys-param file" + des_cli_addition += " --overwrite" + end else abort("\nCommand must include new system parameter file name, ScenarioFile, & FeatureFile. Please try again") end @@ -1786,8 +1792,9 @@ def self.install_python_dependencies if @opthash.subopts[:des_name] des_cli_addition += " #{File.expand_path(@opthash.subopts[:des_name])}" end - if @opthash.subopts[:model_type] - des_cli_addition += " #{@opthash.subopts[:model_type]}" + if @opthash.subopts[:overwrite] + puts "\nDeleting and rebuilding existing Modelica dir" + des_cli_addition += " --overwrite" end else abort("\nCommand must include system parameter file name, FeatureFile, and model name. Please try again") diff --git a/spec/uo_cli_spec.rb b/spec/uo_cli_spec.rb index 9e53b5f8..b639701b 100644 --- a/spec/uo_cli_spec.rb +++ b/spec/uo_cli_spec.rb @@ -312,8 +312,6 @@ def select_measures(test_dir, measure_name_list, workflow = 'base_workflow.osw', before :all do delete_directory_or_file(test_directory) system("#{call_cli} create --project-folder #{test_directory}") - delete_directory_or_file(test_directory_ghe) - system("#{call_cli} create --project-folder #{test_directory_ghe} --ghe") end it 'runs a 2 building scenario using default geometry method', :basic do @@ -326,6 +324,7 @@ def select_measures(test_dir, measure_name_list, workflow = 'base_workflow.osw', end it 'creates a system parameter file', :basic do + skip('Requires Python 3.10') unless system('python3 --version') =~ /3\.10/ system("#{call_cli} des_params --scenario #{test_scenario} --feature #{test_feature} --sys-param-file #{system_parameters_file}") expect(system_parameters_file.exist?).to be true end @@ -405,34 +404,6 @@ def select_measures(test_dir, measure_name_list, workflow = 'base_workflow.osw', expect((test_directory / 'run' / 'two_building_scenario' / 'feature_file_rnm.json').exist?).to be true end - it 'runs a ghe project', :basic do - system("cp #{spec_dir / 'spec_files' / 'baseline_scenario_ghe.csv'} #{test_scenario_ghe}") - puts "copied #{test_scenario_ghe}" - system("#{call_cli} run --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / '4' / 'finished.job').exist?).to be true - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / '5' / 'finished.job').exist?).to be true - end - - it 'default post-processes ghe scenario', :basic do - # This test requires the 'run ghe project' be run first - test_scenario_report = test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'default_scenario_report.csv' - system("#{call_cli} process --default --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") - #expect(`wc -l < #{test_scenario_report}`.to_i).to be > 2 - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'process_status.json').exist?).to be true - end - - it 'creates a system parameter file with GHE properties', :basic do - system("#{call_cli} des_params --scenario #{test_scenario_ghe} --feature #{test_feature_ghe} --sys-param-file #{ghe_system_parameters_file} --ghe") - expect(ghe_system_parameters_file.exist?).to be true - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').exist?).to be true - end - - it 'successfully calls the Thermal Network repository for GHE Sizing', :basic do - system("#{call_cli} ghe_size --sys-param #{ghe_system_parameters_file} --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').exist?).to be true - expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').empty?).to be false - end - it 'saves post-process output as a database file', :basic do # This test requires the 'runs a 2 building scenario using default geometry method' be run first db_filename = test_directory / 'run' / 'two_building_scenario' / 'default_scenario_report.db' @@ -483,6 +454,64 @@ def select_measures(test_dir, measure_name_list, workflow = 'base_workflow.osw', end end + context 'Run and work with a small GHE simulation' do + before :all do + delete_directory_or_file(test_directory_ghe) + system("#{call_cli} create --project-folder #{test_directory_ghe} --ghe") + end + + it 'runs a ghe project', :ghe do + system("cp #{spec_dir / 'spec_files' / 'baseline_scenario_ghe.csv'} #{test_scenario_ghe}") + puts "copied #{test_scenario_ghe}" + system("#{call_cli} run --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / '4' / 'finished.job').exist?).to be true + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / '5' / 'finished.job').exist?).to be true + end + + it 'default post-processes ghe scenario', :ghe do + # This test requires the 'run ghe project' be run first + test_scenario_report = test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'default_scenario_report.csv' + system("#{call_cli} process --default --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") + #expect(`wc -l < #{test_scenario_report}`.to_i).to be > 2 + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'process_status.json').exist?).to be true + end + + it 'creates a system parameter file with GHE properties', :ghe do + system("#{call_cli} des_params --scenario #{test_scenario_ghe} --feature #{test_feature_ghe} --sys-param-file #{ghe_system_parameters_file} --ghe") + expect(ghe_system_parameters_file.exist?).to be true + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').exist?).to be true + end + + it 'overwrites a system parameter file', :ghe do + expect(ghe_system_parameters_file.exist?).to be true + system("#{call_cli} des_params --scenario #{test_scenario_ghe} --feature #{test_feature_ghe} --sys-param-file #{ghe_system_parameters_file} --ghe --overwrite") + expect(ghe_system_parameters_file.exist?).to be true + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').exist?).to be true + end + + it 'successfully calls the Thermal Network repository for GHE Sizing', :ghe do + system("#{call_cli} ghe_size --sys-param #{ghe_system_parameters_file} --scenario #{test_scenario_ghe} --feature #{test_feature_ghe}") + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').exist?).to be true + expect((test_directory_ghe / 'run' / 'baseline_scenario_ghe' / 'ghe_dir').empty?).to be false + end + + it 'creates a Modelica model with the GMT', :ghe do + system("#{call_cli} des_create --feature #{test_feature_ghe} --sys-param #{ghe_system_parameters_file} --des-name #{test_directory_ghe / 'modelica_ghe'}") + expect((test_directory_ghe / 'modelica_ghe'/ 'Districts' / 'DistrictEnergySystem.mo').exist?).to be true + end + + it 'overwrites an existing Modelica model', :ghe do + system("#{call_cli} des_create --feature #{test_feature_ghe} --sys-param #{ghe_system_parameters_file} --des-name #{test_directory_ghe / 'modelica_ghe'} --overwrite") + expect((test_directory_ghe / 'modelica_ghe'/ 'Districts' / 'DistrictEnergySystem.mo').exist?).to be true + end + + it 'runs a Modelica simulation with the GMT', :ghe do + skip('Requires Docker to be installed') unless system('which docker > /dev/null 2>&1') + system("#{call_cli} des_run --model #{test_directory_ghe / 'modelica_ghe'}") + expect((test_directory_ghe / 'modelica_ghe'/ 'modelica_ghe.Districts.DistrictEnergySystem_results' / 'modelica_ghe.Districts.DistrictEnergySystem_res.mat').exist?).to be true + end + end + context 'Run and work with a small GEB simulation' do before :all do delete_directory_or_file(test_directory) From eb647d050a5fa0a205b315fcc1007a33f18d1911 Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 8 Feb 2024 09:54:34 -0700 Subject: [PATCH 4/5] bump to version 0.11.1 --- lib/uo_cli/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uo_cli/version.rb b/lib/uo_cli/version.rb index 031109d6..6f5f3942 100644 --- a/lib/uo_cli/version.rb +++ b/lib/uo_cli/version.rb @@ -5,6 +5,6 @@ module URBANopt module CLI - VERSION = '0.11.0'.freeze + VERSION = '0.11.1'.freeze end end From e1d41e6ff385af91e6ce23bea84a86b9a0f62489 Mon Sep 17 00:00:00 2001 From: Nathan Moore Date: Thu, 8 Feb 2024 14:42:29 -0700 Subject: [PATCH 5/5] v0.11.1 changelog --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eedee79..884de0df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Version 0.11.1 +Date Range: 01/26/2024 - 02/08/2024 + +* Call GMT-cli correctly by @vtnate in https://github.com/urbanopt/urbanopt-cli/pull/449 + + +**Full Changelog**: https://github.com/urbanopt/urbanopt-cli/compare/v0.11.0...v0.11.1 + ## Version 0.11.0 Date Range: 07/20/23 - 01/26/24