Skip to content

Commit

Permalink
Merge pull request #154 from NREL/develop
Browse files Browse the repository at this point in the history
version 2.4.0
  • Loading branch information
kflemin authored May 3, 2024
2 parents 67a66cf + 39c84e4 commit 4b41713
Show file tree
Hide file tree
Showing 156 changed files with 5,436 additions and 6,749 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Test workflow gem

# trigger action on all branches, pull requests and tags
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'
tags:
- '*'

env:
TEST_WITH_OPENSTUDIO: true

jobs:
test:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: install openstudio
run: |
wget http://openstudio-ci-builds.s3-website-us-west-2.amazonaws.com/PR-5149/OpenStudio-3.8.0-beta%2B2bc25028a3-Ubuntu-22.04-x86_64.deb
sudo apt-get -qq install -y ./OpenStudio*.deb
rm -Rf ./OpenStudio*.deb
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.2' # Not needed with a .ruby-version file
bundler: '2.5.5'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically. We should NOT change the Bundler path, because to perform caching, this action will use bundle config --local path $PWD/vendor/bundle.
env:
RUBYLIB: /usr/local/openstudio-3.8.0/Ruby

- name: show enviroment
shell: bash
run: |
begin_group() { echo -e "::group::\033[93m$1\033[0m"; }
begin_group "Ruby and bundler"
echo "Ruby version"
ruby -v
echo "Bundle version"
bundle --version
echo "bundle config get path"
bundle config get path
echo "bundle list"
bundle list
echo "::endgroup::"
begin_group "OpenStudio"
which openstudio
ls -la $(which openstudio)
os_cli=$(readlink -f $(which openstudio))
os_root=$(dirname $(dirname $os_cli))
openstudio --version
openstudio gem_list
echo "::endgroup::"
begin_group "System ruby is connected to openstudio"
# Don't rely on RUBYLIB env var
f=$(ruby -e "puts File.join(RbConfig::CONFIG['sitelibdir'], 'openstudio.rb')")
echo "require '$os_root/Ruby/openstudio.rb'" > $f
ruby -e "require 'openstudio'; puts OpenStudio::openStudioLongVersion"
echo "::endgroup::"
- name: test
shell: bash
run: |
bundle exec rake spec:unit
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
OpenStudio::Workflow Change Log
==================================

Version 2.4.0
-------------
* Minimum Ruby version upgraded to 3.2.2

Version 2.3.1
-------------
* Forward tranlsation when !@run_options.get.forwardTranslateOptions().empty?
* Forward translation when !@run_options.get.forwardTranslateOptions().empty?

Version 2.3.0
-------------
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ source 'http://rubygems.org'
# Specify your gem's dependencies in OpenStudio-workflow.gemspec
gemspec

# gem 'openstudio_measure_tester', '~> 0.4.0', :github => 'NREL/OpenStudio-measure-tester-gem', :ref => '1baa9e70254a0cdb6740ccf14052baada8cf9e1c'

group :test do
gem 'coveralls', require: false
end
28 changes: 7 additions & 21 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC. All rights reserved.
OpenStudio(R), Copyright (c) 2008, 2024 Alliance for Sustainable Energy, LLC.

Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

(1) Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

(3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
or promote products derived from this software without specific prior written permission from the
respective party.
3. Redistribution of this software, without modification, must refer to the software by the same designation. Redistribution of a modified version of this software (i) may not refer to the modified version by the same designation, or by any confusingly similar designation, and (ii) must refer to the underlying software originally provided by Alliance as “OpenStudio®”. Except to comply with the foregoing, the term “OpenStudio®”, or any confusingly similar designation may not be used to refer to any modified version of this software or any modified version of the underlying software originally provided by Alliance without the prior written consent of Alliance.

(4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
4. The name of the copyright holder(s), any contributors, the United States Government, the United States Department of Energy, or any of their employees may not be used to endorse or promote products derived from this software without specific prior written permission from the respective party.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Dependency Status](https://www.versioneye.com/user/projects/5531fb7b10e714121100102e/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5531fb7b10e714121100102e)

## OpenStudio Workflow Gem
## OpenStudio(R) Workflow Gem

This branch is the development branch for the OpenStudio workflow gem.
## Installation
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
# See also https://openstudio.net/license
# *******************************************************************************

require 'bundler'
Bundler.setup

Expand Down
34 changes: 2 additions & 32 deletions lib/openstudio-workflow.rb
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# (1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# (2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# (3) Neither the name of the copyright holder nor the names of any contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission from the respective party.
#
# (4) Other than as required in clauses (1) and (2), distributions in any form
# of modifications or other derivative works may not use the "OpenStudio"
# trademark, "OS", "os", or any other confusingly similar designation without
# specific prior written permission from Alliance for Sustainable Energy, LLC.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
# See also https://openstudio.net/license
# *******************************************************************************

require 'fileutils'
Expand Down
91 changes: 36 additions & 55 deletions lib/openstudio/workflow/adapters/input/local.rb
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# (1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# (2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# (3) Neither the name of the copyright holder nor the names of any contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission from the respective party.
#
# (4) Other than as required in clauses (1) and (2), distributions in any form
# of modifications or other derivative works may not use the "OpenStudio"
# trademark, "OS", "os", or any other confusingly similar designation without
# specific prior written permission from Alliance for Sustainable Energy, LLC.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
# See also https://openstudio.net/license
# *******************************************************************************

require 'openstudio/workflow_json'
Expand Down Expand Up @@ -339,9 +309,40 @@ def ft_options(user_options, default, logger)
no_space_translation: { method_name: :setExcludeSpaceTranslation, min_version: os330 }
}

# user option trumps all others
ft_opts = {}

# try to read from OSW
if @run_options.is_initialized
ftOpts = ""
if @run_options.get.respond_to?(:forwardTranslatorOptions)
# 3.6.0 and above. It still defines forwardTranslateOptions for
# backward compatibility but trying to avoid a Warn in the log
ftOpts = @run_options.get.forwardTranslatorOptions().string()
elsif @run_options.get.respond_to?(:forwardTranslateOptions)
ftOpts = @run_options.get.forwardTranslateOptions()
end
if !ftOpts.empty?
jsonOpts = JSON.parse(ftOpts, symbolize_names: true)

jsonOpts.each do |opt_flag_name, opt_flag|
unless known_ft_opts.key?(opt_flag_name)
log_message = "'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it."
logger.warn log_message
next
end
min_version = known_ft_opts[opt_flag_name.to_sym][:min_version]
if !min_version.nil? && os_version < min_version
log_message = "'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it."
logger.warn log_message
next
end
ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }
end
end
end

# user option trumps all others, so do it last
if user_options[:ft_options]
ft_opts = {}
user_options[:ft_options].each do |opt_flag_name, opt_flag|
puts "#{opt_flag_name} = #{opt_flag}"
unless known_ft_opts.key?(opt_flag_name)
Expand All @@ -357,29 +358,9 @@ def ft_options(user_options, default, logger)
end
ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }
end

return ft_opts
end

# try to read from OSW

if @run_options.is_initialized && @run_options.get.respond_to?(:forwardTranslateOptions) && !@run_options.get.forwardTranslateOptions().empty?
ft_opts = {}
JSON.parse(@run_options.get.forwardTranslateOptions, symbolize_names: true).each do |opt_flag_name, opt_flag|
unless known_ft_opts.key?(opt_flag_name)
log_message = "'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it."
logger.warn log_message
next
end
min_version = known_ft_opts[opt_flag_name.to_sym][:min_version]
if !min_version.nil? && os_version < min_version
log_message = "'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it."
logger.warn log_message
next
end
ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }
end

if !ft_opts.empty?
return ft_opts
end

Expand Down
34 changes: 2 additions & 32 deletions lib/openstudio/workflow/adapters/output/local.rb
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# (1) Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# (2) Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# (3) Neither the name of the copyright holder nor the names of any contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission from the respective party.
#
# (4) Other than as required in clauses (1) and (2), distributions in any form
# of modifications or other derivative works may not use the "OpenStudio"
# trademark, "OS", "os", or any other confusingly similar designation without
# specific prior written permission from Alliance for Sustainable Energy, LLC.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
# GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# OpenStudio(R), Copyright (c) Alliance for Sustainable Energy, LLC.
# See also https://openstudio.net/license
# *******************************************************************************

require 'openstudio/workflow/adapters/output_adapter'
Expand Down
Loading

0 comments on commit 4b41713

Please sign in to comment.