Skip to content

Commit

Permalink
Merge pull request #90 from NREL/develop
Browse files Browse the repository at this point in the history
merge to main for 0.5.0 release
  • Loading branch information
nllong authored Nov 10, 2021
2 parents ae85bfc + 0ad5ecd commit e304679
Show file tree
Hide file tree
Showing 53 changed files with 50,993 additions and 875 deletions.
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AllCops:
Exclude:
- 'spec/test_measures/**/*'

require: rubocop-performance
inherit_from:
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v3.yml
- http://s3.amazonaws.com/openstudio-resources/styles/rubocop_v4.yml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# OpenStudio Model Articulation Gems

## Version 0.5.0
* Support for OpenStudio 3.3 (upgrade to extension gem 0.5.1 and standards gem 0.2.15)
* Fixed [#73]( https://github.com/NREL/openstudio-model-articulation-gem/pull/73 ), added add_empd_material_properties measure contributed by GFlechas
* Fixed [#83]( https://github.com/NREL/openstudio-model-articulation-gem/pull/83 ), adding compatibility matrix and contribution policy
* Fixed [#85]( https://github.com/NREL/openstudio-model-articulation-gem/pull/85 ), For SetWindowToWallRatioByFacade fixed rectangle tol and pre-split at door remove windows

## Version 0.4.1

* Support for OpenStudio 3.2.1 (upgrade to extension gem 0.4.3 and standards gem 0.2.14)
* update to use rubocop_v4
* Documentation update to some measures
* Setting up webhook for https://bcl2.nrel.gov

## Version 0.4.0

* Support Ruby ~> 2.7
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ gemspec
allow_local = ENV['FAVOR_LOCAL_GEMS']

# uncomment when you want CI to use develop branch of extension gem
gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
#gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'

# uncomment when you want CI to use develop branch of openstudio-standards gem
gem 'openstudio-standards', github: 'NREL/OpenStudio-standards', branch: 'master'
#gem 'openstudio-standards', github: 'NREL/OpenStudio-standards', branch: 'master'

# Only uncomment if you need to test a different version of the extension gem
# if allow_local && File.exist?('../OpenStudio-extension-gem')
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ bundle exec rake openstudio:test_with_openstudio
/usr/local/openstudio-3.0.0-beta/bin/openstudio-3.0.0-beta --verbose --bundle '/var/simdata/openstudio/Gemfile' --bundle_path '/var/simdata/openstudio/.bundle/install/' measure -r '/var/simdata/openstudio/lib/measures/radiance_measure/'
```

# Compatibility Matrix

|OpenStudio Model Articulation Gem|OpenStudio|Ruby|
|:--------------:|:----------:|:--------:|
| 0.5.0 | 3.3 | 2.7 |
| 0.4.0 - 0.4.2 | 3.2 | 2.7 |
| 0.3.0 - 0.3.1 | 3.1 | 2.5 |
| 0.2.0 - 0.2.1 | 3.0 | 2.5 |
| 0.1.1 and below | 2.9 and below | 2.2.4 |

# Contributing

Please review the [OpenStudio Contribution Policy](https://openstudio.net/openstudio-contribution-policy) if you would like to contribute code to this gem.

## TODO

- [ ] Move articulation measures from openstudio-measures
Expand Down
13 changes: 10 additions & 3 deletions lib/measures/SetWindowToWallRatioByFacade/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,13 @@ def run(model, runner, user_arguments)

all_surfaces = [s]
if split_at_doors == 'Split Walls at Doors' && has_doors

# remove windows before split at doors
s.subSurfaces.each do |sub_surface|
next if ['Door','OverheadDoor'].include? sub_surface.subSurfaceType
sub_surface.remove
end

# split base surfaces at doors to create multiple base surfaces
split_surfaces = s.splitSurfaceForSubSurfaces.to_a # frozen array

Expand All @@ -341,9 +348,9 @@ def run(model, runner, user_arguments)
vertices.each do |vertex|
# initialize new vertex to old vertex
# rounding values to address tolerance issue 10 digits digits in
x_vals << vertex.x.round(8)
y_vals << vertex.y.round(8)
z_vals << vertex.z.round(8)
x_vals << vertex.x.round(4)
y_vals << vertex.y.round(4)
z_vals << vertex.z.round(4)
end
if x_vals.uniq.size <= 2 && y_vals.uniq.size <= 2 && z_vals.uniq.size <= 2
rect_tri = true
Expand Down
14 changes: 10 additions & 4 deletions lib/measures/SetWindowToWallRatioByFacade/measure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<schema_version>3.0</schema_version>
<name>set_window_to_wall_ratio_by_facade</name>
<uid>c567a0bf-a7d9-4a06-afe9-bf7df79e6bf8</uid>
<version_id>aff8deeb-a011-4ad8-8c0d-22e736faa347</version_id>
<version_modified>20210423T142511Z</version_modified>
<version_id>a02e024d-a1ca-413a-90e2-372cfc217228</version_id>
<version_modified>20210929T221458Z</version_modified>
<xml_checksum>6DE831F7</xml_checksum>
<class_name>SetWindowToWallRatioByFacade</class_name>
<display_name>Set Window to Wall Ratio by Facade</display_name>
Expand Down Expand Up @@ -233,13 +233,19 @@ The measure doesn?t have any cost or lifecycle arguments, however If lifecycle o
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>DC3FE3CF</checksum>
<checksum>6631CF18</checksum>
</file>
<file>
<filename>SetWindowToWallRatioByFacade_Test.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>23972ACF</checksum>
<checksum>0F626DE3</checksum>
</file>
<file>
<filename>prototype_sec_sch.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>581DA01B</checksum>
</file>
</files>
</measure>
Original file line number Diff line number Diff line change
Expand Up @@ -737,4 +737,49 @@ def test_SetWindowToWallRatioByFacade_all_orientations
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/output/all_orientations.osm')
model.save(output_file_path, true)
end

# this has multiple sub-surafces in base surfaes, including more than 1 door and more than one window
def test_SetWindowToWallRatioByFacade_sec_school
# create an instance of the measure
measure = SetWindowToWallRatioByFacade.new

# create an instance of a runner
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)

# load the test model
translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new(File.dirname(__FILE__) + '/prototype_sec_sch.osm')
model = translator.loadModel(path)
assert(!model.empty?)
model = model.get

# get arguments
arguments = measure.arguments(model)

# set argument values to good values and run the measure on model with spaces
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)

wwr = arguments[0].clone
assert(wwr.setValue(0.7))
argument_map['wwr'] = wwr

sillHeight = arguments[1].clone
assert(sillHeight.setValue(30.0))
argument_map['sillHeight'] = sillHeight

facade = arguments[2].clone
assert(facade.setValue('All'))
argument_map['facade'] = facade

measure.run(model, runner, argument_map)
result = runner.result
show_output(result)
assert(result.value.valueName == 'Success')
# assert(result.warnings.size == 2)
# assert(result.info.size == 2)

# save the model
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + '/output/sec_school.osm')
model.save(output_file_path, true)
end
end
Loading

0 comments on commit e304679

Please sign in to comment.