Skip to content

Commit

Permalink
Merge pull request #451 from urbanopt/develop
Browse files Browse the repository at this point in the history
Prep v0.11.1
  • Loading branch information
kflemin authored Feb 8, 2024
2 parents 6d39156 + e1d41e6 commit ab858d2
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 62 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/nightly_ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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()

Expand Down
16 changes: 8 additions & 8 deletions FindOpenStudioSDK.cmake
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -13,26 +13,26 @@ 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 "+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()
Expand Down
19 changes: 13 additions & 6 deletions lib/uo_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion lib/uo_cli/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

module URBANopt
module CLI
VERSION = '0.11.0'.freeze
VERSION = '0.11.1'.freeze
end
end
89 changes: 59 additions & 30 deletions spec/uo_cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ab858d2

Please sign in to comment.