Skip to content

Commit

Permalink
Merge pull request #141 from NREL/develop
Browse files Browse the repository at this point in the history
Version 0.10.0 Release
  • Loading branch information
kflemin authored Jul 12, 2024
2 parents 4737673 + 8f87d90 commit 866cf07
Show file tree
Hide file tree
Showing 67 changed files with 2,281 additions and 4,676 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# OpenStudio Model Articulation Gems

## Version 0.10.0
* Support for OpenStudio 3.8 (upgrade to standards gem 0.6.0, extension gem 0.8.0)
* Support Ruby 3.2.2

## Version 0.9.0
* Support for OpenStudio 3.7 (upgrade to standards gem 0.5.0, extension gem 0.6.0)
* Fixed [#128]( https://github.com/NREL/openstudio-model-articulation-gem/pull/128 ), fix infiltration design day schedule inversion
Expand Down
17 changes: 12 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ gemspec
# checkout the latest version (develop) from github.
allow_local = ENV['FAVOR_LOCAL_GEMS']

# Delete when these branchesa are merged and released
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'wenyi-bypass-zlib'
# gem 'openstudio-standards', github: 'NREL/openstudio-standards', tag: 'v0.6.0.rc2', ref: "1c42110"
# gem 'openstudio_measure_tester', :git => 'https://github.com/NREL/OpenStudio-measure-tester-gem.git', :branch => 'wenyi-dependencies-update'
# gem 'openstudio-workflow', :git => 'https://github.com/NREL/OpenStudio-workflow-gem.git', :branch => 'develop', ref: "32126e9b9f6"
# gem 'bcl', :git => 'https://github.com/wenyikuang/bcl-gem.git', :branch => 'develop'

# Only uncomment if you need to test a different version of the extension gem
# if allow_local && File.exist?('../OpenStudio-extension-gem')
# gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
# elsif allow_local
# gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
# end
if allow_local && File.exist?('../OpenStudio-extension-gem')
gem 'openstudio-extension', path: '../OpenStudio-extension-gem'
elsif allow_local
gem 'openstudio-extension', github: 'NREL/OpenStudio-extension-gem', branch: 'develop'
end
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/NREL/cbci_jenkins_libs

@Library('cbci_shared_libs') _
@Library('cbci_shared_libs@developExtension') _

// Build for PR to develop branch only.
if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { // check if set
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ bundle exec rake openstudio:test_with_openstudio

|OpenStudio Model Articulation Gem|OpenStudio|Ruby|
|:--------------:|:----------:|:--------:|
| 0.10.0 | 3.8 | 3.2.2 |
| 0.9.0 | 3.7 | 2.7 |
| 0.8.0 | 3.6 | 2.7 |
| 0.7.0 | 3.5 | 2.7 |
Expand Down
69 changes: 32 additions & 37 deletions lib/measures/SimplifyGeometryToSlicedBar/measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
# see the URL below for access to C++ documentation on model objects (click on "model" in the main window to view model objects)
# http://openstudio.nrel.gov/sites/openstudio.nrel.gov/files/nv_data/cpp_documentation_it/model/html/namespaces.html

# load OpenStudio measure libraries from openstudio-extension gem
require 'openstudio-extension'
require 'openstudio/extension/core/os_lib_helper_methods'
require 'openstudio/extension/core/os_lib_geometry'
# load OpenStudio measure libraries from openstudio-standards gem
require 'openstudio-standards'

# load OpenStudio measure libraries
require "#{File.dirname(__FILE__)}/resources/os_lib_cofee"
Expand Down Expand Up @@ -78,8 +76,8 @@ def run(model, runner, user_arguments)
# get total floor area for building
building = model.getBuilding
totalFloorArea = building.floorArea # TODO: - this doesn't include spaces tagged as not included in floor area. This would include spaces like plenums and attics
runner.registerInfo("Initial Floor Area is #{OsLib_HelperMethods.neatConvertWithUnitDisplay(totalFloorArea, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)}.")

runner.registerInfo("Initial Floor Area is #{OpenStudio.toNeatString(OpenStudio.convert(totalFloorArea, 'm^2', 'ft^2').get, 0, true)}.")
# get get number of floors. Assume that user has properly used story object.
numStories = 0
stories = model.getBuildingStorys
Expand Down Expand Up @@ -108,15 +106,15 @@ def run(model, runner, user_arguments)
spaceTypes.each do |spaceType|
next if spaceType.spaces.empty?

result = OsLib_HelperMethods.getAreaOfSpacesInArray(model, spaceType.spaces, areaType = 'floorArea')
spaceTypeHash[spaceType] = result['totalArea']
totalSpaceTypeArea += result['totalArea']
result = OpenstudioStandards::Geometry.spaces_get_floor_area(spaceType.spaces)
spaceTypeHash[spaceType] = result
totalSpaceTypeArea += result
end

runner.registerInfo("Initial Space Type Total Floor Area is #{OsLib_HelperMethods.neatConvertWithUnitDisplay(totalSpaceTypeArea, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)}.")
runner.registerInfo("Initial Space Type Total Floor Area is #{OpenStudio.toNeatString(OpenStudio.convert(totalSpaceTypeArea, 'm^2', 'ft^2').get, 0, true)}.")

spaceTypeHash.sort_by { |key, value| value }.reverse_each do |k, v|
runner.registerInfo("Floor Area for #{k.name} is #{OsLib_HelperMethods.neatConvertWithUnitDisplay(v, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)}.")
runner.registerInfo("Floor Area for #{k.name} is #{OpenStudio.toNeatString(OpenStudio.convert(v, 'm^2', 'ft^2').get, 0, true)}.")
end

# TODO: - warn if some spaces are not included in floor area (plenum and attic)
Expand All @@ -127,19 +125,18 @@ def run(model, runner, user_arguments)
# todo - this measure wont' touch HVAC systems, consider warning user if model already has HVAC, as it won't be hooked up to anything after this.

# get wall and window area by facade
starting_spaces = model.getSpaces
areaByFacade = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model, starting_spaces, options = {})
northWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['northWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
southWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['southWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
eastWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['eastWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
westWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['westWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
areaByFacade = OpenstudioStandards::Geometry.model_get_exterior_window_and_wall_area_by_orientation(model)
northWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['north_wall'], 'm^2', 'ft^2').get, 0, true)
southWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['south_wall'], 'm^2', 'ft^2').get, 0, true)
eastWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['east_wall'], 'm^2', 'ft^2').get, 0, true)
westWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['west_wall'], 'm^2', 'ft^2').get, 0, true)
runner.registerInfo("Initial Exterior Wall Breakdown. North: #{northWallGross}, South: #{southWallGross}, East: #{eastWallGross}, West: #{westWallGross}")

# reporting initial condition of model
floorArea_si = OsLib_HelperMethods.getAreaOfSpacesInArray(model, starting_spaces, areaType = 'floorArea')['totalArea']
floorArea_ip = OsLib_HelperMethods.neatConvertWithUnitDisplay(floorArea_si, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
exteriorArea_si = OsLib_HelperMethods.getAreaOfSpacesInArray(model, starting_spaces, areaType = 'exteriorWallArea')['totalArea']
exteriorArea_ip = OsLib_HelperMethods.neatConvertWithUnitDisplay(exteriorArea_si, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
floorArea_si = OpenstudioStandards::Geometry.spaces_get_floor_area(model.getSpaces)
floorArea_ip = OpenStudio.toNeatString(OpenStudio.convert(floorArea_si, 'm^2', 'ft^2').get, 0, true)
exteriorArea_si = OpenstudioStandards::Geometry.spaces_get_exterior_wall_area(model.getSpaces)
exteriorArea_ip = OpenStudio.toNeatString(OpenStudio.convert(exteriorArea_si, 'm^2', 'ft^2').get, 0, true)

runner.registerInitialCondition("The building started with #{floorArea_ip} of floor area, and #{exteriorArea_ip} of exterior wall area.")

Expand All @@ -159,9 +156,9 @@ def run(model, runner, user_arguments)
lengthX = xmax - xmin
lengthY = ymax - ymin
areaBounding = lengthX * lengthY
lengthX_display = OsLib_HelperMethods.neatConvertWithUnitDisplay(lengthX, 'm', 'ft', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
lengthY_display = OsLib_HelperMethods.neatConvertWithUnitDisplay(lengthY, 'm', 'ft', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
areaBounding_display = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaBounding, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
lengthX_display = OpenStudio.toNeatString(OpenStudio.convert(lengthX, 'm', 'ft').get, 0, true)
lengthY_display = OpenStudio.toNeatString(OpenStudio.convert(lengthY, 'm', 'ft').get, 0, true)
areaBounding_display = OpenStudio.toNeatString(OpenStudio.convert(areaBounding, 'm^2', 'ft^2').get, 0, true)
runner.registerInfo("Bounding box area is #{areaBounding_display}. #{lengthX_display} by #{lengthY_display}.")

# get target footprint size
Expand All @@ -187,8 +184,8 @@ def run(model, runner, user_arguments)

else
areaTarget = totalFloorArea / numStories
lengthXTarget_Bar1 = (areaByFacade['northWall'] + areaByFacade['southWall']) / (2 * (zmax - zmin))
lengthYTarget_Bar2 = (areaByFacade['eastWall'] + areaByFacade['westWall']) / (2 * (zmax - zmin))
lengthXTarget_Bar1 = (areaByFacade['north_wall'] + areaByFacade['south_wall']) / (2 * (zmax - zmin))
lengthYTarget_Bar2 = (areaByFacade['east_wall'] + areaByFacade['west_wall']) / (2 * (zmax - zmin))
lengthYTarget_Bar1 = areaTarget / (lengthXTarget_Bar1 + lengthYTarget_Bar2)
lengthXTarget_Bar2 = lengthYTarget_Bar1

Expand Down Expand Up @@ -243,20 +240,18 @@ def run(model, runner, user_arguments)

end

# get wall and window area by facade
finishing_spaces = model.getSpaces
areaByFacade = OsLib_Geometry.getExteriorWindowAndWllAreaByOrientation(model, finishing_spaces, options = {})
northWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['northWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
southWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['southWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
eastWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['eastWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
westWallGross = OsLib_HelperMethods.neatConvertWithUnitDisplay(areaByFacade['westWall'], 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
areaByFacade = OpenstudioStandards::Geometry.model_get_exterior_window_and_wall_area_by_orientation(model)
northWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['north_wall'], 'm^2', 'ft^2').get, 0, true)
southWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['south_wall'], 'm^2', 'ft^2').get, 0, true)
eastWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['east_wall'], 'm^2', 'ft^2').get, 0, true)
westWallGross = OpenStudio.toNeatString(OpenStudio.convert(areaByFacade['west_wall'], 'm^2', 'ft^2').get, 0, true)
runner.registerInfo("Final Exterior Wall Breakdown. North: #{northWallGross}, South: #{southWallGross}, East: #{eastWallGross}, West: #{westWallGross}")

# reporting final condition of model
floorArea_si = OsLib_HelperMethods.getAreaOfSpacesInArray(model, finishing_spaces, areaType = 'floorArea')['totalArea']
floorArea_ip = OsLib_HelperMethods.neatConvertWithUnitDisplay(floorArea_si, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
exteriorArea_si = OsLib_HelperMethods.getAreaOfSpacesInArray(model, finishing_spaces, areaType = 'exteriorWallArea')['totalArea']
exteriorArea_ip = OsLib_HelperMethods.neatConvertWithUnitDisplay(exteriorArea_si, 'm^2', 'ft^2', 0, unitBefore = false, unitAfter = true, space = true, parentheses = true)
floorArea_si = OpenstudioStandards::Geometry.spaces_get_floor_area(model.getSpaces)
floorArea_ip = OpenStudio.toNeatString(OpenStudio.convert(floorArea_si, 'm^2', 'ft^2').get, 0, true)
exteriorArea_si = OpenstudioStandards::Geometry.spaces_get_exterior_wall_area(model.getSpaces)
exteriorArea_ip = OpenStudio.toNeatString(OpenStudio.convert(exteriorArea_si, 'm^2', 'ft^2').get, 0, true)

runner.registerFinalCondition("The building finished with #{floorArea_ip} of floor area, and #{exteriorArea_ip} of exterior wall area.")

Expand Down
114 changes: 34 additions & 80 deletions lib/measures/SimplifyGeometryToSlicedBar/measure.xml
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@
<?xml version="1.0"?>
<measure>
<schema_version>3.0</schema_version>
<schema_version>3.1</schema_version>
<name>simplify_geometry_to_sliced_bar</name>
<uid>eb218516-5fa5-47fe-948d-274777c7d592</uid>
<version_id>f596f08b-a427-4ccf-ad9b-04da056a8665</version_id>
<version_modified>20230602T160044Z</version_modified>
<version_id>3c5abf7b-a4fb-482a-b075-be91623c8f4f</version_id>
<version_modified>2024-05-20T07:54:33Z</version_modified>
<xml_checksum>45097B60</xml_checksum>
<class_name>SimplifyGeometryToSlicedBar</class_name>
<display_name>SimplifyGeometryToSlicedBar</display_name>
<description>This is an experimental measure looking at ways to simply the geometry, or to create geometry when you only no percentage of space types number of floors and total area. This technique will match the building floor area but will sacrifice the exterior exposure. So it will produce better results on more boxy buildings than a building with many wings. I may try to come up with solution that also tries to maintain exterior exposure in another version.</description>
<modeler_description>I'm going to extract space type area breakdown and number of floors from the source model. I'll also keep track of exterior exposure. I won't directly use exterior exposure but can report the change in this as a kind of confidence metric. I'll then create a bar building using the bounding box aspect ratio, but shrunk to fit the building area. I will slice the building across the shorter axis by space type. The two most prevalent space types will go on the outside of the building. Instead of core and perimeter zoning the building will have a variation with square corners. I will create one zone per space, and will use a zone multiplier for any building more than 3 stories tall.



































In a future version I may try to identify similar spaces types and blend them together before slicing, although I expect that will be a separate measure, so it is more modular.</modeler_description>
<arguments>
<argument>
Expand Down Expand Up @@ -89,10 +55,10 @@ In a future version I may try to identify similar spaces types and blend them to
</attributes>
<files>
<file>
<filename>UShapedHotelExample.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>7E96D119</checksum>
<filename>LICENSE.md</filename>
<filetype>md</filetype>
<usage_type>license</usage_type>
<checksum>BFFB1AA6</checksum>
</file>
<file>
<filename>README.md</filename>
Expand All @@ -107,10 +73,27 @@ In a future version I may try to identify similar spaces types and blend them to
<checksum>703C9964</checksum>
</file>
<file>
<filename>UShapedHotelExample/run.db</filename>
<filetype>db</filetype>
<version>
<software_program>OpenStudio</software_program>
<identifier>2.0.0</identifier>
<min_compatible>3.8.0</min_compatible>
</version>
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>1F503C21</checksum>
</file>
<file>
<filename>os_lib_cofee.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>2C77E71F</checksum>
</file>
<file>
<filename>SimplifyGeometryToSlicedBar_Test.rb</filename>
<filetype>rb</filetype>
<usage_type>test</usage_type>
<checksum>9230B5CD</checksum>
<checksum>03F6E2E5</checksum>
</file>
<file>
<filename>UShapedHotelExample/files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw</filename>
Expand All @@ -125,45 +108,16 @@ In a future version I may try to identify similar spaces types and blend them to
<checksum>EE6FAF90</checksum>
</file>
<file>
<filename>LICENSE.md</filename>
<filetype>md</filetype>
<usage_type>license</usage_type>
<checksum>BFFB1AA6</checksum>
</file>
<file>
<filename>os_lib_helper_methods.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>996C5B97</checksum>
</file>
<file>
<filename>os_lib_cofee.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>7162FF96</checksum>
</file>
<file>
<version>
<software_program>OpenStudio</software_program>
<identifier>2.0.0</identifier>
<min_compatible>2.8.0</min_compatible>
</version>
<filename>measure.rb</filename>
<filetype>rb</filetype>
<usage_type>script</usage_type>
<checksum>8D1BD320</checksum>
</file>
<file>
<filename>os_lib_geometry.rb</filename>
<filetype>rb</filetype>
<usage_type>resource</usage_type>
<checksum>788EF0F2</checksum>
<filename>UShapedHotelExample/run.db</filename>
<filetype>db</filetype>
<usage_type>test</usage_type>
<checksum>9230B5CD</checksum>
</file>
<file>
<filename>SimplifyGeometryToSlicedBar_Test.rb</filename>
<filetype>rb</filetype>
<filename>UShapedHotelExample.osm</filename>
<filetype>osm</filetype>
<usage_type>test</usage_type>
<checksum>03F6E2E5</checksum>
<checksum>7E96D119</checksum>
</file>
</files>
</measure>
Loading

0 comments on commit 866cf07

Please sign in to comment.