Skip to content

Update ShadingControl - #4103

Closed
joseph-robertson wants to merge 5 commits into
developfrom
shading-controls-2
Closed

Update ShadingControl#4103
joseph-robertson wants to merge 5 commits into
developfrom
shading-controls-2

Conversation

@joseph-robertson

@joseph-robertson joseph-robertson commented Sep 29, 2020

Copy link
Copy Markdown
Collaborator

Pull request overview

  • DO NOT MERGE
  • Prevent adding different-zone sub surfaces on a single shading control

Please read OpenStudio Pull Requests to better understand the OpenStudio Pull Request protocol.

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Checked behavior in OpenStudioApplication, adjusted policies as needed (src/openstudio_lib/library/OpenStudioPolicy.xml)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

@joseph-robertson joseph-robertson added component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Sep 29, 2020
@joseph-robertson joseph-robertson added this to the OpenStudio SDK 3.1.0 milestone Sep 29, 2020
@joseph-robertson joseph-robertson self-assigned this Sep 29, 2020
@joseph-robertson
joseph-robertson changed the base branch from 3.1.0-rc1 to develop October 2, 2020 17:04
@joseph-robertson joseph-robertson removed this from the OpenStudio SDK 3.1.0 milestone Jan 13, 2021
Comment on lines +470 to +485
// Check if zone of subSurface not zone of existing subSurfaces
if (boost::optional<Space> space = subSurface.space()) {
if (boost::optional<ThermalZone> thermalZone = space->thermalZone()) {
for (auto& subSurface2 : subSurfaces()) {
if (boost::optional<Space> space2 = subSurface2.space()) {
if (boost::optional<ThermalZone> thermalZone2 = space2->thermalZone()) {
if (thermalZone->handle() != thermalZone2->handle()) {
LOG(Warn, briefDescription() << ": cannot add two surfaces that are in different Thermal Zones ('" << thermalZone->nameString()
<< "' versus existing '" << thermalZone2->nameString() << "')");
return false;
}
}
}
}
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I thought @shorowit said that this is actually fine now to have a multiple zones referenced in the same ShadingControl? #4066 (comment)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not an expert on this object and there are so many ways to use it that it becomes very confusing. But as far as I know, it has always been fine to have subsurfaces of multiple zones referenced by a single ShadingControl, at least under some circumstances. When we did this, we used the "OnIfScheduleAllows" shading control type. If you instead used a control type that depends on the thermal zone specified, I don't know what would happen.

Comment on lines +373 to +380
auto it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
if (it == zoneHandleToShadingControlVectorMap.end()) {
zoneHandleToShadingControlVectorMap.insert(std::make_pair(zoneHandle, std::vector<ShadingControl>()));
}
it = zoneHandleToShadingControlVectorMap.find(zoneHandle);
OS_ASSERT(it != zoneHandleToShadingControlVectorMap.end());
it->second.push_back(shadingControl);
shadingControl.additionalProperties().setFeature("Shading Control Sequence Number", (int)it->second.size());

@jmarrec jmarrec Mar 16, 2021

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The FT change seems to make sense though. What's weird and not handled (I have no clue how to properly handle that though) is the case where you have something like:

  • Shading Control 1 controls Zone1-SurfaceA1
  • Shading Control 2 controls Zone2-SurfaceA2 and Zone2-SurfaceA2

Then what happens to the Shading Control Sequence Number? Shading Control 2 would have a Shading Control Sequence Number of 2 (assuming it wasn't renamed, since the sort is done on name...), but Zone2-SurfaceA2 is referenced by only one shading control with a sequence number of 2. Does that make sense and is E+ ok with it? (I don't know).

@shorowit thoughts please? It's been a while I've used ShadingControls; and never since the E+ 9.4 changes, and I don't think the E+ API got any clearer in this specific case...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have no experience with the Shading Control Sequence Numbers, sorry. (I've never used the ShadingControl object in a way where the sequence numbers mattered.)

@joseph-robertson

Copy link
Copy Markdown
Collaborator Author

@jmarrec @shorowit See #4066 (comment).

@joseph-robertson

Copy link
Copy Markdown
Collaborator Author

Closing for now. Issue captured in #4602.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component - Model Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants