-
Notifications
You must be signed in to change notification settings - Fork 9
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
#4533 - Wrap SurfaceProperty:LocalEnvironment and SurfaceProperty:SurroundingSurfaces #163
Conversation
…operty:SurroundingSurfaces cf NREL/OpenStudio#4535
def test_surface_properties_lwr_rb | ||
result = sim_test('surface_properties_lwr.rb') | ||
end | ||
|
||
# TODO: To be added in the next official release after: 3.3.0 | ||
# def test_surface_properties_lwr_osm | ||
# result = sim_test('surface_properties_lwr.osm') | ||
# end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Register new ruby test + TODO for the OSM one
############################################################################### | ||
# A P I D E M O # | ||
############################################################################### | ||
|
||
# NOTE: you can access an OptionalSurfacePropertyLocalEnvironment from any | ||
# surface and subsurfaces | ||
raise if surface.surfacePropertyLocalEnvironment.get != localEnv | ||
|
||
# The API also enforces uniqueness at this level: there can be only one | ||
# SurfacePropertyLocalEnvironment pointing to a single Surface/SubSurface | ||
# If you try to assign a second via the SurfacePropertyLocalEnvironment(surface) ctor or calling | ||
# SurfacePropertyLocalEnvironment::setExteriorSurface(surface) and surface | ||
# already has one, then the existing one is **REMOVED** | ||
raise if model.getSurfacePropertyLocalEnvironments.size != 1 | ||
|
||
localEnv = OpenStudio::Model::SurfacePropertyLocalEnvironment.new(surface) | ||
localEnv.setName("#{surface.nameString} LocalEnv") | ||
raise if model.getSurfacePropertyLocalEnvironments.size != 1 | ||
# as you can see, this one does NOT have an external shading fraction schedule | ||
raise if !localEnv.externalShadingFractionSchedule.empty? | ||
|
||
############################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made an effort to demonstrate the entire API.
############################################################################### | ||
# A P I D E M O # | ||
############################################################################### | ||
|
||
# Demonstrate the api a bit more | ||
raise if s_sp.numberofSurroundingSurfaceGroups != 2 | ||
|
||
# You can navigate up and down | ||
raise if localEnv.surfacePropertySurroundingSurfaces.get != s_sp | ||
raise if s_sp.surfacePropertyLocalEnvironment.get != localEnv | ||
|
||
# Note that the gorupIndex matches on Surrounding Surface name only | ||
raise if s_sp.surroundingSurfaceGroupIndex(group1).get != s_sp.surroundingSurfaceGroupIndex('SurroundingSurface1').get | ||
|
||
# Also note that API enforces uniqueness of Surrouding Surface Name | ||
# if I try to add another group with the same surface name, it overrides the | ||
# values | ||
s_sp.addSurroundingSurfaceGroup('SurroundingSurface2', 0.4, tempSch1) | ||
raise if s_sp.numberofSurroundingSurfaceGroups != 2 | ||
raise if s_sp.surroundingSurfaceGroups[1].viewFactor != 0.4 | ||
|
||
# Save the groups | ||
groups = s_sp.surroundingSurfaceGroups | ||
|
||
s_sp.removeSurroundingSurfaceGroup(1) | ||
raise if s_sp.numberofSurroundingSurfaceGroups != 1 | ||
|
||
s_sp.addSurroundingSurfaceGroup('SurroundingSurface2', 0.4, tempSch1) | ||
s_sp.removeAllSurroundingSurfaceGroups | ||
raise if s_sp.numberofSurroundingSurfaceGroups != 0 | ||
|
||
# Add back via the vector overload | ||
s_sp.addSurroundingSurfaceGroups(groups) | ||
raise if s_sp.numberofSurroundingSurfaceGroups != 2 | ||
|
||
g1 = s_sp.surroundingSurfaceGroups[0] | ||
|
||
raise if g1.surroundingSurfaceName != 'SurroundingSurface1' | ||
raise if g1.viewFactor != 0.5 | ||
raise if g1.temperatureSchedule != tempSch1 | ||
|
||
g2 = s_sp.getSurroundingSurfaceGroup(1).get | ||
raise if g2.surroundingSurfaceName != 'SurroundingSurface2' | ||
raise if g2.viewFactor != 0.4 | ||
raise if g2.temperatureSchedule != tempSch1 | ||
|
||
############################################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Includng showcasing how to work with the extensible groups and the helper class SurroundingSurfaceGroup
for the SurfacePropertySurroundingSurfaces
class
Pull request overview
Add a test for #4533 - SurfaceProperty:LocalEnvironment and SurfaceProperty:SurroundingSurfaces
Companion PR: NREL/OpenStudio#4535
Link to the Linux.deb installer to use for CI Testing. If not set, it will default to latest official release.
[OpenStudio Installer]: http://openstudio-ci-builds.s3-website-us-west-2.amazonaws.com/incremental/develop/4535/OpenStudio-3.3.1-alpha%2B1ec9beea4e-Ubuntu-18.04.deb
This Pull Request is concerning:
NewTest
: a new test for a new model API class,Case 1: New test for a new model API class
Companion PR for NREL/OpenStudio#4535
will specifically test for two new classes:
SurfacePropertySurroundingSurfaces
SurfacePropertyLocalEnvironment
Work Checklist
The following has been checked to ensure compliance with the guidelines:
Tests pass either:
PendingOSM
has been added to this PRmodel_tests.rb
has a TODO.out.osw
have been committed as they need to be run with an official OpenStudio versionRuby test is stable: when run multiple times on the same machine, it produces the same total site kBTU.
Please paste the heatmap png generated after running the following commands:
model.getThermalZones.sort_by{|z| z.name.to_s}.each do ...
so I am sure I put the same ZoneHVAC systems to the same zones regardless of their order)process_results.py
(seepython process_results.py --help
for usage).Object has been added to
autosize_hvac.rb
to ensure the autosizedXXX values methods do work: N/AReview Checklist
# TODO
added tomodel_tests.rb
out.osw
have been committedautosize_hvac
as appropriateNewTest
,TestFix
,NewTestForExisting
,Other
NewTest
: addPendingOSM
orAddedOSM