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

fix/97 - simulation issues #98

Merged
merged 71 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
3fd782c
update: README
corymosiman12 Nov 12, 2020
5f6511a
test: add new L000 testing file
corymosiman12 Nov 12, 2020
2fa8282
tests(translator): add tests for translator.write_osm, translator.run…
corymosiman12 Nov 12, 2020
b8b10bb
tests(translator): check results.xml file actually exists
corymosiman12 Nov 13, 2020
9a202ec
docs: update
corymosiman12 Nov 13, 2020
d55d986
refactor(translator): run_baseline_osm function
corymosiman12 Nov 13, 2020
63e702e
tests: add new helper function
corymosiman12 Nov 13, 2020
a26e117
feat(epw_file_path): add methods to access epw
corymosiman12 Nov 13, 2020
8da94a3
test: spec_helper update
corymosiman12 Nov 13, 2020
c726935
tests: update travis
corymosiman12 Nov 13, 2020
c2d212e
tests: update travis
corymosiman12 Nov 13, 2020
7303002
fix: code cleanup, additional testing
corymosiman12 Nov 13, 2020
427c841
fix: code cleanup, additional testing
corymosiman12 Nov 13, 2020
07d2469
docs: update README
corymosiman12 Nov 13, 2020
5b15a1e
tests(fix): typo
corymosiman12 Nov 13, 2020
83ea1d0
update: README
corymosiman12 Nov 13, 2020
1661a13
update: travis
corymosiman12 Nov 13, 2020
9862468
tests(fix)
corymosiman12 Nov 13, 2020
c8afb34
feat(constants): define centrally
corymosiman12 Nov 14, 2020
0ba5ce5
update: travis
corymosiman12 Nov 14, 2020
511876c
fix(spec): new check so simulations are not failing; results being co…
corymosiman12 Nov 14, 2020
f7719aa
feat(constants): remove from translator
corymosiman12 Nov 14, 2020
10e1719
update: remove ModelMaker inheritance, docs
corymosiman12 Nov 14, 2020
57b231b
tests(workflow_maker): add new tests
corymosiman12 Nov 14, 2020
c57614c
tests: update
corymosiman12 Nov 14, 2020
5095f30
update: travis
corymosiman12 Nov 14, 2020
6f16c68
fix: tests
corymosiman12 Nov 14, 2020
0470e4e
tests(workflow_maker): define expectations when no scenarios found
corymosiman12 Nov 16, 2020
a604755
tests: fix file
corymosiman12 Nov 16, 2020
3248032
refactor: files to schema v2.2.0
corymosiman12 Nov 17, 2020
2054d83
tests: update
corymosiman12 Nov 17, 2020
c9982d1
tests(fix): building_section_spec
corymosiman12 Nov 17, 2020
fe7b357
tests(update): breakout into new files
corymosiman12 Nov 17, 2020
6c202ca
tests(fix): building_spec
corymosiman12 Nov 17, 2020
e5c3b7c
tests: update
corymosiman12 Nov 17, 2020
101093b
feat(generator): move methods from spec_helper
corymosiman12 Nov 17, 2020
0bbdec6
tests(fix): loads_system_spec
corymosiman12 Nov 17, 2020
48a7637
tests: fix
corymosiman12 Nov 17, 2020
00ccd6f
tests: fix
corymosiman12 Nov 17, 2020
ee26105
tests(update)
corymosiman12 Nov 17, 2020
6b12149
tests(update)
corymosiman12 Nov 17, 2020
0c73048
tests(add): helper spec to travis
corymosiman12 Nov 17, 2020
7123783
tests: fix
corymosiman12 Nov 18, 2020
dbc9370
tests: update selection tool with version
corymosiman12 Nov 18, 2020
21a5ee2
fix: selection tool
corymosiman12 Nov 18, 2020
ea08642
tests: uncomment
corymosiman12 Nov 18, 2020
271fe7f
tests: updaty model articulation specs so ACTUALLY checking if simula…
corymosiman12 Nov 18, 2020
1b94292
tests: add Chicago weather files
corymosiman12 Nov 18, 2020
4af24ae
tests: update tests to use Chicago weather file
corymosiman12 Nov 18, 2020
ff43755
updates
corymosiman12 Nov 24, 2020
125be82
updates
corymosiman12 Nov 24, 2020
aced55c
update travis
corymosiman12 Nov 24, 2020
66b1555
fix: building
corymosiman12 Nov 24, 2020
53cfa33
fix
corymosiman12 Nov 24, 2020
17ababb
fix: generator
corymosiman12 Nov 24, 2020
cf0a96c
fix
corymosiman12 Nov 25, 2020
8a60c98
fix: systems updates
corymosiman12 Nov 25, 2020
39a53d2
fixing
corymosiman12 Nov 25, 2020
473b98b
fix lighting system
corymosiman12 Nov 25, 2020
1724d4b
keep fixing
corymosiman12 Nov 26, 2020
028dd93
keep on it
corymosiman12 Nov 26, 2020
2eae6e7
fix
corymosiman12 Nov 26, 2020
7e25ccd
AllResourceTotal and ResourceUse annual results
corymosiman12 Nov 29, 2020
8bc19af
fix: monthly processing working
corymosiman12 Dec 1, 2020
3cdccce
fix
corymosiman12 Dec 1, 2020
1a8ca46
add thermostat heating and cooling schedules, many other updates
corymosiman12 Dec 2, 2020
2a4d5f8
rubocop:auto_correct
corymosiman12 Dec 2, 2020
20ab1bc
fix(loads_system): use model_get_lookup_name and space_type.setStanda…
corymosiman12 Dec 2, 2020
3df7d16
minor fixes
corymosiman12 Dec 2, 2020
211ca8d
add Report, Utility, AuditDate, Contact classes; refactor to accomodate
corymosiman12 Dec 16, 2020
4d6c5c1
remove unused files; SelectionTool passing; update XML files per use …
corymosiman12 Dec 16, 2020
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
35 changes: 27 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,50 @@ jobs:
- $SH "bundle exec rspec spec/tests/model_articulation_test/facility_spec.rb"
- $SH "bundle exec rspec spec/tests/model_articulation_test/hvac_system_spec.rb"
- $SH "bundle exec rspec spec/tests/model_articulation_test/loads_system_spec.rb"
- $SH "bundle exec rspec spec/tests/model_articulation_test/lighting_system_type_spec.rb"
- $SH "bundle exec rspec spec/tests/model_articulation_test/service_hot_water_system_spec.rb"
- $SH "bundle exec rspec spec/tests/model_articulation_test/site_spec.rb"
# - $SH "bundle exec rspec spec/tests/model_articulation_test/weather_file_download_spec.rb" // fails sometimes due to connection issues, so we exclude it here
name: "Model Articulation Tests"
- script:
- travis_wait 40 $SH "bundle exec rspec spec/tests/model_articulation_test/hospital_occupancy_type_spec.rb"
Copy link
Member

Choose a reason for hiding this comment

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

We are going to run out of travis credits pretty soon. Leave this as-is, but we will need to move over to github actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are already out...

Copy link
Member

Choose a reason for hiding this comment

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

travis definitely fits in 2020

name: "Model Articulation Hospital Occupancy Type Spec"
- script:
- $SH "bundle exec rspec spec/tests/model_articulation_test/occupancy_types_spec.rb"
name: "Model Articulation Occupancy Types Spec"
- script:
- travis_wait 50 $SH "bundle exec rspec spec/tests/translator_spec.rb"
name: "Translator Spec"
- script:
- travis_wait 40 $SH "bundle exec rspec spec/tests/model_articulation_test/hospital_occupancy_type_spec.rb"
name: "Hospital Occupancy Type Spec"
- $SH "bundle exec rspec spec/tests/translator_sizing_run_spec.rb"
name: "Translator Sizing Run Spec"
- script:
- $SH "bundle exec rspec spec/tests/translator_baseline_simulation_spec.rb"
name: "Translator Perform SR and Baseline Simulation Spec"
- script:
- $SH "bundle exec rspec spec/tests/model_articulation_test/occupancy_types_spec.rb"
name: "Occupancy Types Spec"
- $SH "bundle exec rspec spec/tests/translator_baseline_gather_save_spec.rb"
name: "Translator Perform SR and Baseline Simulations, Gather and Save Results Spec"
- script:
- $SH "bundle exec rspec spec/tests/translator_baseline_generation_spec.rb"
- $SH "bundle exec rspec spec/tests/translator_scenario_generation_spec.rb"
name: "Translator Generation Specs"
- script:
- $SH "bundle exec rspec spec/tests/translator_baseline_simulation_spec.rb"
name: "Translator Baseline Simulation Spec"
- script:
- $SH "bundle exec rspec spec/tests/translator_scenario_simulations_spec.rb"
name: "Translator Scenario Simulation Spec"
- script:
- $SH "bundle exec rspec spec/tests/scenario_spec.rb"
- $SH "bundle exec rspec spec/tests/time_series_spec.rb"
- $SH "bundle exec rspec spec/tests/resource_use_spec.rb"
- $SH "bundle exec rspec spec/tests/all_resource_total_spec.rb"
name: "Scenario Related Specs"
- script:
- $SH "bundle exec rspec spec/tests/workflow_maker_spec.rb"
name: "WorkflowMaker Spec"
- script:
- $SH "bundle exec rspec spec/tests/building_sync_spec.rb"
- $SH "bundle exec rspec spec/tests/epw_test_spec.rb"
- $SH "bundle exec rspec spec/tests/constants_spec.rb"
- $SH "bundle exec rspec spec/tests/generator_spec.rb"
- $SH "bundle exec rspec spec/tests/helper_spec.rb"
- $SH "bundle exec rspec spec/tests/xml_get_set_spec.rb"
# - $SH "bundle exec rspec spec/tests/selection_tool_spec.rb" # selection tool is not working with ASHRAE level 1.5 yet
name: "Other Specs"
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'http://rubygems.org'

gemspec
Expand Down
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,34 @@ Or install it yourself as:
All of the features described above are provided by the translator class, as shown in the following sample code:

```ruby
building_sync_xml_file_path = 'path/to/bsync.xml'
out_path = 'path/to/output_dir'

# initializing the translator
translator = BuildingSync::Translator.new(building_sync_xml_file_path, out_path)
# generating the OpenStudio Model and writing the osm file
translator.write_osm

# generating the OpenStudio Model and writing the osm file.
# path/to/output_dir/SR and path/to/output_dir/in.osm created
translator.setup_and_sizing_run

# generating the OpenStudio workflows and writing the osw files
# auc:Scenario elements with measures are turned into new simulation dirs
# path/to/output_dir/scenario_name
translator.write_osws
# running the baseline simulations
translator.run_osm
# running all simulations

# running the baseline simulation
# path/to/output_dir/Baseline/in.osm
translator.run_baseline_osm

# run all simulations
translator.run_osws
# gather the results and save them to an BuildingSync.XML

# gather the results for all scenarios found in out_path
translator.gather_results(out_path)

# write results to xml
save_file = File.join(out_path, 'results.xml')
translator.save_xml(save_file)
```
## Testing

Expand Down
27 changes: 27 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
# All rights reserved.
Expand Down Expand Up @@ -47,4 +49,29 @@ require 'openstudio/model_articulation'
rake_task = OpenStudio::Extension::RakeTask.new
rake_task.set_extension_class(OpenStudio::ModelArticulation::Extension)

desc 'Convert tabs to spaces'
task :remove_tabs do
Copy link
Member

Choose a reason for hiding this comment

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

yes!

Dir['examples/**/*.xml', 'BuildingSync.xsd'].each do |file|
puts " Cleaning #{file}"
doc = Nokogiri.XML(File.read(file)) do |config|
config.default_xml.noblanks
end

doc.xpath('//comment()').each do |node|
if node.text.match?(/XMLSpy/)
node.remove
end
end

File.open(file, 'w') { |f| f << doc.to_xml(indent: 2) }
end

if File.exist? 'BuildingSync.json'
f = JSON.parse(File.read('BuildingSync.json'))
File.open('BuildingSync.json', 'w') do |file|
file << JSON.pretty_generate(f)
end
end
end

task default: :spec
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'buildingsync'
Expand Down
2 changes: 2 additions & 0 deletions buildingsync.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'buildingsync/version'
Expand Down
2 changes: 2 additions & 0 deletions lib/buildingsync.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
# BuildingSync(R), Copyright (c) 2015-2020, Alliance for Sustainable Energy, LLC.
Expand Down
52 changes: 52 additions & 0 deletions lib/buildingsync/all_resource_total.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
# BuildingSync(R), Copyright (c) 2015-2020, 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 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.
# *******************************************************************************

module BuildingSync
# ResourceUse class
class AllResourceTotal
include BuildingSync::Helper
include BuildingSync::XmlGetSet
def initialize(base_xml, ns)
@base_xml = base_xml
@ns = ns

help_element_class_type_check(base_xml, 'AllResourceTotal')
end
end
end
48 changes: 48 additions & 0 deletions lib/buildingsync/constants.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
# BuildingSync(R), Copyright (c) 2015-2020, 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 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.
# *******************************************************************************

SCHEMA_2_0_URL = 'https://raw.githubusercontent.com/BuildingSync/schema/v2.0/BuildingSync.xsd'
Copy link
Member

Choose a reason for hiding this comment

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

thanks for making these obvious. Is there documentation (in the README) saying to update these when upgrading the version of BuidngSync?

SCHEMA_2_2_0_URL = 'https://raw.githubusercontent.com/BuildingSync/schema/v2.2.0/BuildingSync.xsd'
PHASE_0_BASE_OSW_FILE_PATH = File.expand_path(File.join(__dir__, 'makers/phase_zero_base.osw'))
WORKFLOW_MAKER_JSON_FILE_PATH = File.expand_path(File.join(__dir__, 'makers/workflow_maker.json'))
BUILDING_AND_SYSTEMS_FILE_PATH = File.expand_path(File.join(__dir__, 'model_articulation/building_and_system_types.json'))

# Standards strings
ASHRAE90_1 = 'ASHRAE90.1'
CA_TITLE24 = 'CaliforniaTitle24'
2 changes: 2 additions & 0 deletions lib/buildingsync/extension.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# *******************************************************************************
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
# BuildingSync(R), Copyright (c) 2015-2020, Alliance for Sustainable Energy, LLC.
Expand Down
Loading