Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prep version 0.2.1 #129

Merged
merged 4 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# BuildingSync Gem

## Version 0.2.1 (Unreleased)
## Version 0.2.1

- Update copyright dates
- Update URL for BuildingSync selection tool
- Include buildingsync/generators when including gem by default
- BuildingSync to OpenStudio Translation for MLOD 200
- Add action for building the documentation
- Fix purge measures method to only remove measures with SKIP argument set to True

## Version 0.2.0

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ installed, then export the path of the folder that contains the openstudio.rb fi

After installing OpenStudio and setting the environment variable, then add this line to your application's Gemfile:
```ruby
gem 'buildingsync', '0.2.0'
gem 'buildingsync', '0.2.1'
```

And then execute:
Expand Down
15 changes: 12 additions & 3 deletions lib/buildingsync/makers/workflow_maker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,15 +518,24 @@ def deep_copy_workflow
# Removes unused measures from a workflow, where __SKIP__ == true
# @param workflow [Hash] a hash of the openstudio workflow, typically after a deep
# copy is made and the measures are configured for the specific scenario
# KAF: reworked to only delete measures with an explicit __SKIP__ == true
# (sometimes measure don't have a skip at all, assume we want to keep those)
def purge_skipped_from_workflow(workflow)
non_skipped = []
if !workflow.nil? && !workflow['steps'].nil? && workflow.key?('steps')
workflow['steps'].each do |step|
if !step.nil? && step.key?('arguments') && !step['arguments'].nil?
if step['arguments'].key?('__SKIP__') && step['arguments']['__SKIP__'] == false
if !step.nil? && step.key?('arguments')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find and fix!

if step['arguments'].nil?
# no arguments, keep anyway
non_skipped << step
elsif step['arguments'].key?('__SKIP__') && step['arguments']['__SKIP__'] == false
# skip is set to false, keep
non_skipped << step
elsif !step['arguments'].key?('__SKIP__')
# no "SKIP" argument, keep anyway
non_skipped << step
end
end
end
end
workflow['steps'] = non_skipped
end
Expand Down
11 changes: 6 additions & 5 deletions lib/buildingsync/translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def initialize(xml_file_path, output_dir, epw_file_path = nil, standard_to_be_us
if validate_xml_file_against_schema
validate_xml
else
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Translator.initialize', "File '#{xml_file_path}' was not validated against the BuildingSync schema")
puts "File '#{xml_file_path}' was not validated against the BuildingSync schema"
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Translator.initialize', "File '#{xml_file_path}' was not validated against the BuildingSync schema version #{@schema_version}")
puts "File '#{xml_file_path}' was not validated against the BuildingSync schema version #{@schema_version}"
end

super(doc, ns)
Expand All @@ -109,11 +109,12 @@ def validate_xml
if !selection_tool.validate_schema
raise "File '#{@xml_file_path}' does not valid against the BuildingSync schema"
else
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Translator.initialize', "File '#{@xml_file_path}' is valid against the BuildingSync schema")
OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Translator.initialize', "File '#{@xml_file_path}' is valid against the BuildingSync schema version #{@schema_version}")
puts "File '#{@xml_file_path}' is valid against the BuildingSync schema"
end
rescue StandardError
OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Translator.initialize', "File '#{@xml_file_path}' does not valid against the BuildingSync schema")
rescue StandardError => error
puts "ERROR: #{error}"
OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Translator.initialize', "File '#{@xml_file_path}' does not validate against the BuildingSync schema version #{@schema_version}")
end

# @see WorkflowMaker.setup_and_sizing_run
Expand Down
2 changes: 1 addition & 1 deletion lib/buildingsync/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
# provides features for reading BldgSync XML files, generating baseline models, creating scenario workflows, running simulations and adding simulation results to the BldgSync file
module BuildingSync
# version of the BuildingSync gem
VERSION = '0.2.0'
VERSION = '0.2.1'
end