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

#4533 - Wrap SurfaceProperty:LocalEnvironment and SurfaceProperty:SurroundingSurfaces #163

Merged
merged 1 commit into from
Mar 23, 2022

Conversation

jmarrec
Copy link
Contributor

@jmarrec jmarrec commented Feb 18, 2022

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:

  • Case 1 - 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:

    • with current develop (incude SHA):
      • The label PendingOSM has been added to this PR
      • A matching OSM test has not yet been added because the official release is pending, but model_tests.rb has a TODO.
      • No out.osw have been committed as they need to be run with an official OpenStudio version
  • Ruby 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:

    • I ensured that I assign systems/loads/etc in a repeatable manner (eg: if I assign stuff to thermalZones, I do 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)
    • I tested stability using process_results.py (see python process_results.py --help for usage).
  • Object has been added to autosize_hvac.rb to ensure the autosizedXXX values methods do work: N/A


Review Checklist

  • Code style (indentation, variable names, strip trailing spaces)
  • Functional code review (it has to work!)
  • Matching OSM test has been added or # TODO added to model_tests.rb
  • Appropriate out.osw have been committed
  • Test is stable
  • Object is tested in autosize_hvac as appropriate
  • The appropriate labels have been added to this PR:
    • One of: NewTest, TestFix, NewTestForExisting, Other
    • If NewTest: add PendingOSM or AddedOSM

@jmarrec jmarrec added NewTest PR type: a new test for a new model API class PendingOSM A matching OSM test has yet to be added with the next official OpenStudio Release labels Feb 18, 2022
@jmarrec jmarrec self-assigned this Feb 18, 2022
Comment on lines +1031 to +1039
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

Copy link
Contributor Author

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

Comment on lines +57 to +78
###############################################################################
# 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?

###############################################################################
Copy link
Contributor Author

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.

Comment on lines +116 to +162
###############################################################################
# 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

###############################################################################
Copy link
Contributor Author

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

@jmarrec jmarrec merged commit a6262a4 into develop Mar 23, 2022
@jmarrec jmarrec deleted the 4533_SurfacePropertySurroundingSurfaces branch March 23, 2022 16:45
@jmarrec jmarrec added AddedOSM A matching OSM test has been added with an official OpenStudio release and removed PendingOSM A matching OSM test has yet to be added with the next official OpenStudio Release labels Jun 21, 2022
jmarrec added a commit that referenced this pull request Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AddedOSM A matching OSM test has been added with an official OpenStudio release NewTest PR type: a new test for a new model API class
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant